How to measure angle between two lines?

조회 수: 1 (최근 30일)
thineesh Vijayakumar
thineesh Vijayakumar 2019년 4월 8일
댓글: A. Sawas 2019년 4월 8일
How to measure the angle ? Can anyone share coding. Thank you

답변 (1개)

A. Sawas
A. Sawas 2019년 4월 8일
P1 = [1,1];
P2 = [5,5];
P3 = [5,2];
P4 = [1,3];
xL1 = P1(1)-P2(1);
xL2 = P3(1)-P4(1);
yL1 = P1(2)-P2(2);
yL2 = P3(2)-P4(2);
angle = 180 - acos((xL1*xL2+yL1*yL2)/(sqrt(xL1^2+xL2^2)*sqrt(yL1^2+yL2^2)))*180/pi;
figure;
plot([P1(1),P2(1)],[P1(2),P2(2)],'-+'); hold on;
plot([P3(1),P4(1)],[P3(2),P4(2)],'-*');
  댓글 수: 2
thineesh Vijayakumar
thineesh Vijayakumar 2019년 4월 8일
Thank you but the angle value doesnt appear.
A. Sawas
A. Sawas 2019년 4월 8일
The value is in the variable angle
disp(angle)

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by