필터 지우기
필터 지우기

How to find angle between 2 3D vectors?

조회 수: 2 (최근 30일)
Ampi
Ampi 2013년 6월 1일
편집: Kamal 2013년 11월 23일
Hello, I have 2 sets of 3D data and I want to find out the angle between the two after dimensionality reduction. I have written the following code but the accurate angle is not showing.
z2 and z3 are the two mesh grids generated from the 3D data.
[V2,D2]=eigs(z2);
P2=svd(V2);
[V1,D1] = eigs(z3);
V1=sort(V1,'descend');
P1=svd(V1);
angle = atan2(norm(cross(P1,P2)), dot(P1,P2))
Can anybody help me in this regard? Thanks in advance, Ampi.
  댓글 수: 3
Roger Stafford
Roger Stafford 2013년 6월 1일
If P1 and P2 are three-element vectors, your formula for the 3D inner angle between them is correct. However I have questions about the preceding code. For example, if you use the non-negative singular values coming from 'svd' for P1 and P2 element values, that restricts your angle to the range 0 to pi/2 radians (0 to 90 degrees). How do you justify that? What are the sizes of z2 and z3? If they are other than 3-by-3, you will have something other than three eigenvectors in V2 and V1 and consequently other than three singular values in both P2 and P1 vectors.
Kamal
Kamal 2013년 11월 23일
편집: Kamal 2013년 11월 23일
Dear Roger, I have one question about the princomp function. Can you help me?

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

답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 6월 2일
hi,
is it atan or cos^-1 (acos) because the scalat product is :
V.U=||U||.||V||.cos(U^V);

카테고리

Help CenterFile Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by