Someone please point out what is going on with this piece of code. Matlab is running the first 3 concatenations fine, and not the last one. It's driving me crazy. It spits out
Error using vertcat Dimensions of matrices being concatenated are not consistent.
for that line. Please help. Thanks!
e = [1 1 1 1];vertcat( 2*(e(2)*e(4) - e(3)*e(1)),2*(e(3)*e(4) + e(2)*e(1)),e(4)^2 + e(1)^2 - e(2)^2 -e(3)^2); % calling vertcat works
[ 2*(e(2)*e(4) - e(3)*e(1)) 2*(e(3)*e(4) + e(2)*e(1)) e(4)^2 + e(1)^2 - e(2)^2 -e(3)^2]; % horizontal works
% subing in works
a = 2*(e(2)*e(4) - e(3)*e(1)); b = 2*(e(3)*e(4) + e(2)*e(1)); c = e(4)^2 + e(1)^2 - e(2)^2 -e(3)^2;[a; b; c]% but this doesn't work for some reason...
[ 2*(e(2)*e(4) - e(3)*e(1));2*(e(3)*e(4) + e(2)*e(1));e(4)^2 + e(1)^2 - e(2)^2 -e(3)^2];
Best Answer