How can I convert x-y-data in a 2D plot to a range of 0..360 degrees?
15 views (last 30 days)
Show older comments
How can I convert x-y-data in a 2D plot to to a range of 0..360 degrees? I don't want to have polar coordinates, but simply an angle between 0 and 360 degrees.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
There is no special MATLAB function available to do this. Maybe the following example can help:
function a = angle(x,y)
len = length(x);
for i = 1:len
if atan2(y(i),x(i))>=0
a(i) = (180/pi) * atan2(y(i),x(i));
else
a(i) = (180/pi) * (atan2(y(i),x(i))+2*pi);
end
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!