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 中查找有关 Lengths and Angles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!