Hi, I have two vectors v1=[0; -1/sqrt(2);1/sqrt(2)]; and v2=[0; 1/sqrt(2); -1/sqrt(2)]; which I am trying to plot on the same figure, with diffrent colors and the end and start points with stars (*). But when I do this and click "run" I get an error "Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'." Is there a simpler way of writing this?
v1=[0; -1/sqrt(2);1/sqrt(2)];t=linspace(0,1,100);a = v1*t;v2=[0; 1/sqrt(2); -1/sqrt(2)];t=linspace(0,1,100);b = v2*t;plot3(a(:,1),a(:,2),a(:,3),'lineWidth',2,'Marker','*', 'r' );hold onplot3(b(:,1),b(:,2),b(:,3),'lineWidth',2,'Marker','*', 'g');
Best Answer