Plotting Vector in 3D Using Matlab

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 6K views
phantomprime
Messages
7
Reaction score
0
Didn't know where to put this though its also a math problem..

I have to plot the vector in 3d using matlab

v1=[8;2;-6]
v2=[12;3;-9]

v1 =

8
2
-6


v2 =

12
3
-9


v2= (1.5) * v1

Now I used...quiver3(v1,v2)

It gives me the line though I don't know if that line is the span of the two vectors or is the quiver function just plotting one line. My question is..is there a way to plot v1, v2 and have it calculate and show the third line in 3d in matlab?
 
Physics news on Phys.org
phantomprime said:
Didn't know where to put this though its also a math problem..

I have to plot the vector in 3d using matlab

v1=[8;2;-6]
v2=[12;3;-9]

v1 =

8
2
-6


v2 =

12
3
-9


v2= (1.5) * v1

Now I used...quiver3(v1,v2)

It gives me the line though I don't know if that line is the span of the two vectors or is the quiver function just plotting one line. My question is..is there a way to plot v1, v2 and have it calculate and show the third line in 3d in matlab?

You're not making at clear what it is that you want to do. First off, I can't see what the command

Code:
quiver3(v1, v2)

is supposed to do: It gives me an empty plot.

You say you've got two vectors, v1 and v2; do you want to plot these vectors in 3D? If so, quiver3 will do that for you. For instance, the following code will give you a plot of the two vectors, both of whose tails are at the origin:

Code:
quiver3(0,0,0,8,2,-6)
hold on
quiver3(0,0,0,12,3,-9)
hold off

The first three numbers specify the origin of the vectors, and the remaining three numbers specify the components of the vectors in Cartesian coordinates. Is this what you're looking for? I can't quite figure out what you're talking about when you mention a "third" vector: you've mentioned only two vectors in your statement of the problem.
 
what of v2= (1.5) * v1
 
phantomprime said:
what of v2= (1.5) * v1

What about it?
 
My mistake..I meant the vector was suppoedly the span of V1 and V2. So would the graph be different or the same?