필터 지우기
필터 지우기

Angle between two vectors in 3d

조회 수: 307 (최근 30일)
developer
developer 2011년 9월 20일
댓글: Bruno Luong 2023년 2월 1일
Hello,
I have two vectors in 3d and i want to find the angle between those two vectors.
Thanks in advance

채택된 답변

Jan
Jan 2011년 9월 20일
Or:
angle = atan2(norm(cross(a,b)), dot(a,b))
See this compact discussion about this topic: CSSM: Angle between two vectors . Only 71 replies (Google finds 89 replies, so I assume 18 spam messages?) and 68300 views currently...
[EDITED]: W. Kahan suggested in his paper "Mindeless.pdf":
2 * atan(norm(x*norm(y) - norm(x)*y) / norm(x * norm(y) + norm(x) * y))
  댓글 수: 9
Dyuman Joshi
Dyuman Joshi 2023년 2월 1일
@Jan the CSSM thread you linked does not exist anymore.
Do you happen to have an archived link for that thread?
I am unable to find the thread by simply searching the title, on the Google Groups (CSSM archive)

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Lucas García
Lucas García 2011년 9월 20일
You can use the subspace function to find the angle between two subspaces:
>> subspace([1;0;0],[0;1;0])
ans =
1.5708
  댓글 수: 1
Yadu Bhusal
Yadu Bhusal 2021년 8월 5일
I have 3 points in a line( suppose) and one calculations point separately. A(1,1,1)B(2,2,2)C(3 3 3) in a line and P( 5 5 5) as separate. I want to calculate angle A which is subtended by distance AP. And similar for BP,CP. Is it possible to find angles or make program to calculate these angles at once?

댓글을 달려면 로그인하십시오.


David Young
David Young 2011년 9월 20일
acos(dot(v1, v2) / (norm(v1) * norm(v2)))
EDIT: Having seen Jan Simon's reply, and the long thread at CSSM that he refers to, I realise that the formula I proposed is not a particularly good one. The two methods in Jan's reply are both likely to be preferable.
  댓글 수: 2
developer
developer 2011년 9월 20일
Thanks actually i have seen the post referred by Jan simon
and confused that what is the difference between
angle = atan2(norm(cross(a,b)), dot(a,b))
and
acos(dot(v1, v2) / (norm(v1) * norm(v2)))
Jan
Jan 2011년 9월 20일
Mathematically identical, but numerically more stable, when the vectors have very different lengths:
acos(dot(v1 / norm(v1), v2 / norm(v2)))

댓글을 달려면 로그인하십시오.


rashi
rashi 2018년 6월 15일
hi I want to find the angle in azimuth and elevation plane between wo vectors in 3d. please help

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by