Mike Glaz
Mike Glaz

Reputation: 5392

Plotting vector in 3D in Matlab

I'm studying Linear Algebra. I would like to visualize a vector [2, 1, 2] in 3D. I used the following command:

quiver3(0,0,0,2,1,2)

And either my understanding of Linear Algebra is off or I'm doing something wrong with MATLAB. But what the plot looks like to me is that it's plotting vector [1.8, 0.9, 1.8].

Upvotes: 3

Views: 850

Answers (1)

Suever
Suever

Reputation: 65470

By default, quiver3 will use whatever scaling that optimizes the display of the vectors.

quiver3(...,scale) automatically scales the vectors to prevent them from overlapping, and then multiplies them by scale. scale = 2 doubles their relative length, and scale = 0.5 halves them. Use scale = 0 to plot the vectors without the automatic scaling.

You'll want to specify the scale parameter as 0 to prevent this automatic scaling and to accurately represent the data that you provide

quiver3(0, 0, 0, 2, 1, 2, 0);

enter image description here

Upvotes: 5

Related Questions