MATLAB Plotting Vector in 3D Using Matlab

AI Thread Summary
The discussion revolves around plotting two vectors, v1 and v2, in 3D using MATLAB. The user initially attempts to use the quiver3 function but is unclear if it correctly represents the span of the two vectors. They express confusion about how to visualize both vectors and potentially a third vector representing their span. A response clarifies that the quiver3 function can plot vectors originating from the same point, suggesting a specific code format to achieve this. The responder also questions the mention of a "third" vector, emphasizing that only two vectors were provided. The user acknowledges that v2 is a scalar multiple of v1 and wonders if this affects the graphical representation. The conversation highlights the need for clarity in plotting vector relationships and understanding vector spans in MATLAB.
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?
 

Similar threads

Back
Top