Hi guys. Lets say I have two points, and I want to find the angle (0 to 360 deg measured counter clockwise) from the x-axis to the line connecting those two points. How can I do that in an efficient way?
Example: Point 1 is [1,2] and Point 2 is [4,11]

 採用された回答

Matt J
Matt J 2023 年 5 月 9 日
編集済み: Matt J 2023 年 5 月 9 日

1 投票

One way:
dPt=normalize(Point2-Point1,'n');
angle=acosd(dPt(1)) %degrees

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2021a

タグ

質問済み:

2023 年 5 月 9 日

編集済み:

2023 年 5 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by