Hi I am trying to find angle between 3 vectors;
Terminal vector:-0.063695 -0.588189 2.333766
1. vector: 0.008239 -0.640457 2.295980 2.vector: -0.024011 -0.216596 2.461521
Could anyone help me?
Thanks in advance

 Akzeptierte Antwort

Mischa Kim
Mischa Kim am 5 Feb. 2014

1 Stimme

You can make use of the dot product (between vectors):
vec1 = [-0.063695 -0.588189 2.333766];
vec2 = [0.008239 -0.640457 2.295980];
angle_12 = acos(dot(vec1,vec2)/(norm(vec1)*norm(vec2)))
and similar for the other pairs of vectors.

3 Kommentare

barbar
barbar am 5 Feb. 2014
Thank you for your response but I ve already tried that command. Actually I misrepresented my problem.
Right know I have three positions and each one is in the 3d space. The origin of these positions is terminal position. So I want to find the angle between these positions which is created by first and second positions on terminal position. Sorry about my poor writing skills but I hope I express myself clearly. Thanks again
I see...
vec = [-0.063695 -0.588189 2.333766];
vec1 = [0.008239 -0.640457 2.295980];
vec2 = [-0.024011 -0.216596 2.461521];
dv1 = vec1 - vec;
dv2 = vec2 - vec;
angle_12 = acos(dot(dv1,dv2)/(norm(dv1)*norm(dv2)))
barbar
barbar am 5 Feb. 2014
Thank you.I guess displacement calc. should work for my situation.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Roger Stafford
Roger Stafford am 5 Feb. 2014

0 Stimmen

The 'atan2' function is more accurate than 'acos' for vectors that are nearly parallel. For two 3D vectors v1 and v2, do this:
ang = atan2(norm(cross(v1,v2)),dot(v1,v2));
This angle will be in radians.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 5 Feb. 2014

Kommentiert:

am 5 Feb. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by