Direction between points from [0,360]
古いコメントを表示
I have 5 points which has (x,y) position and want to calculate the direction from one point to the other. I used atan2d but the output is confusing. Is there any way to bypass the different signs for counterclockwise and clockwise and get the output to be between [0,360] from clockwise only?
Thanks
採用された回答
その他の回答 (1 件)
Ameer Hamza
2020 年 9 月 25 日
編集済み: Ameer Hamza
2020 年 9 月 25 日
Add 2pi to negative values.
x = -1;
y = -1;
theta = atan2(y, x);
if theta < 0
theta = theta + 2*pi;
end
1 件のコメント
John D'Errico
2020 年 9 月 25 日
The OP apparently wants results in DEGREES.
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!