필터 지우기
필터 지우기

about angles between each column

조회 수: 1 (최근 30일)
Bo Wang
Bo Wang 2016년 3월 11일
댓글: Roger Stafford 2016년 3월 11일
Hi, I have a problem that let me determine the angles between each columns in a m*n matrix. I already know that how to calculate the angle between each column, but how can I store these values in a n*n matrix G where Gij is the angle between ith column and jth column? Here is my code:
function G=angle(a)
[m,n]=size(a);
G1=atand(norm(cross(a(:,1),a(:,1)),dot(a(:,1),a(:,1))));
end
Thank you!

답변 (1개)

Stalin Samuel
Stalin Samuel 2016년 3월 11일
I am not sure about the formula. But you can refer the below code for store the values
[m,n]=size(a);
for it1 = 1:n
for it2 = 1:n
G1(it1,it2)=atand(norm(cross(a(:,it1),a(:,it2)),dot(a(:,it1),a(:,it2))));
end
end
  댓글 수: 2
Bo Wang
Bo Wang 2016년 3월 11일
Thank you! It works perfect!
Roger Stafford
Roger Stafford 2016년 3월 11일
That should be 'atan2d' in your code, not 'atand'. The function 'atand' takes only one argument.

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

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by