Unit vectors. How can I plot them?

49 次查看(过去 30 天)
Ocram
Ocram 2012-4-28
Dear all, I need to plot vectors given as a matrix of several row and three column. For each row I would like to plot an indipendent vector using three scalar (the cosin director).
Do you have any idea? Regards, MG
************************************************************************************************************************************
I wrote this: quiver3(zeros(3,1),zeros(3,1),zeros(3,1),[1;0;0],[0;1;0],[0;0;1]) in order to create a reference system XYZ. This is ok!!
Now I want to plot a line (a unit vector) over the refernce system...for example V=[0.22 0.51 -0.82]. I don't have any origin or any end pont... just the direction cosine. I got this vector V in this way: Using two 3D point (for example A and B) I get the vector v=A-B then the unit vector V= (A-B)/norm(A-B) So If I want to plot V, without A and B, but only using V... how can I do?
Thanks
[EDITED, Jan S, copied from answer section]:
3D plot. Just a simple line without arrows. I tried with quiver3 but in this function I can only insert point to point coordinates. But I just have the direction....
  2 个评论
Jan
Jan 2012-4-28
Do you want a 2D or 3D plot? Do you want thin lines or thicker 3D lines, arrow heads or lines only? Please post more details.
BTW, please vote and accept answers, which helped you.
Jan
Jan 2012-4-29
Please add further explanations by adding to the original question, not by creating an answer.

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2012-4-29
quiver3(zeros(3,1),zeros(3,1),zeros(3,1),[1;0;0],[0;1;0],[0;0;1]);
hold('on');
quiver3(0,0,0,V(1),V(2),V(3), 'r');

Jan
Jan 2012-4-29
The direction of a unit vector is the end position of the vector, when you start from the origin. Please post, what you have tried with quiver3 and explain, which problems occurred.

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by