inverse of tan at 90 degree

조회 수: 7 (최근 30일)
mukesh bisht
mukesh bisht 2021년 5월 25일
답변: Star Strider 2021년 5월 25일
Hi.
Iam using "atand((y2-y1)/(x2-x1))" function to calculate angle. But i incure problem when my denomitor is zero. Sometimes it gives +90 and sometimes -90 degree, even though sign of cordinates of every point is same.
Please suggest way to resolve this issue.
  댓글 수: 1
James Tursa
James Tursa 2021년 5월 25일
Please give specific example, with numbers, to show where you are getting +90 and -90 even though you think the signs of the inputs are the same.

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

답변 (1개)

Star Strider
Star Strider 2021년 5월 25일
A more robust approach would be atan2d, since it provides a 4-quadrant angle.
y2 = 20;
y1 = 10;
x2 = 42;
x1 = 42;
Theta1 = atan2d((y2-y1), (x2-x1))
Theta1 = 90
y2 = 10;
y1 = 20;
x2 = 42;
x1 = 42;
Theta2 = atan2d((y2-y1), (x2-x1))
Theta2 = -90
.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by