Unit vectors. How can I plot them?

49 views (last 30 days)
Ocram
Ocram on 28 Apr 2012
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 Comments
Jan
Jan on 28 Apr 2012
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 on 29 Apr 2012
Please add further explanations by adding to the original question, not by creating an answer.

Sign in to comment.

Answers (2)

Jan
Jan on 29 Apr 2012
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 on 29 Apr 2012
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.

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!