Plot Vector using Plot3

9 visualizaciones (últimos 30 días)
Jacque
Jacque el 13 de Mzo. de 2012
Hi guys,
I've calculated a vector using the cross product of 2 vectors and am curious how I can input this so that I can draw a plot.
How can I input it in a way that my i, j and k values will correspond to x, y and z values?
Thanks for any help

Respuestas (2)

Tom
Tom el 13 de Mzo. de 2012
Since vectors aren't really tied to points, you need to first specify a starting point for your vectors. If you want them to have common point, say (a,b,c). I would then construct x, y, z coordinate vectors like
x = i*t + a
y = j*t + b
z = k*t + c
where t is the parameter of the parametrized equations; it determines the length of your vectors. All that's left is plotting x, y and z.
  1 comentario
Jacque
Jacque el 13 de Mzo. de 2012
Sorry I wasn't quite sure how to use 't' (not the letter, but the function you're implying) so I've kinda got an answer that isn't right, but this seems closer.
What I've done now is:
Vperp = cross(AC,BD);
i = Vperp(1);
j = Vperp(2);
k = Vperp(3);
plot3(i,j,k,'k');
etc..
and even though this plot is much larger than plot it's running perp. too, i think it might be doing the right thing.
I have two vectors and I would like to plot the perp. plot starting from the intersect.
Is there a way I can specify the start position of a plot like this and have a line connected from the specified start to the vector, without using the hold function?
Thank you for your response, I will use it to spur some lateral thinking

Iniciar sesión para comentar.


Tom
Tom el 14 de Mzo. de 2012
I would set t=0:0.05:1;, for instance.
I was thinking of using the hold function when plotting. Without it I would think you would have to be smart about the order that you plot the points (the order of the arrays). But if it looks like it's working (and is correct), it probably is. The length of the cross product always tends to be larger than the initial vectors. I would just divide the entire resultant vector by a factor of 2 or 3, whatever looked better.
  2 comentarios
Jacque
Jacque el 17 de Mzo. de 2012
Sorry I took so long to respond to this. The problem with using hold is that the vector is changing at each iteration, so rather than having a straight arrow which shows the direction of the vector, I'm getting a wavey line over the plotted course of the vector's positions. Does this sound confusing? I found it hard to word it.
But thank you because you helped me understand that regardless of the factor the vector is multiplied by, the vector will still be acting in the same direction.
In MuPAD I can plot the vector as an arrow; is there a way I can either combine MuPAD with my code or can I simply plot an arrow in MATLAB?
Walter Roberson
Walter Roberson el 17 de Mzo. de 2012
annotation() can be used to plot arrows.
http://www.mathworks.com/help/techdoc/creating_plots/f0-33318.html

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by