# How can I find the angle between two vectors that answer should be between 0 to 2*pi

22 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Bjorn Gustavsson
on 31 Mar 2023

This question has been answered several times:

angle-betwen-two-3d-vectors-in-the-range-0-360-degree, angle-between-two-vectors-in-matlab. But you should also have a think about why your question isn't sufficiently well stated - what's the positive direction for your angle and why do you chose that direction?

HTH

##### 9 Comments

Torsten
on 31 Mar 2023

### More Answers (1)

Luca Ferro
on 31 Mar 2023

Edited: Luca Ferro
on 31 Mar 2023

This question is a duplicate of: https://ch.mathworks.com/matlabcentral/answers/16243-angle-between-two-vectors-in-3d

As suggested there you can trya variation like this:

angle=180*atan2(norm(cross(a,b)), dot(a,b))

where a,b are your vectors.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!