MATLAB: How to convert x-y-data in a 2D plot to a range of 0..360 degrees

anglecartesiancoordinatesMATLABpolar

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.

Best Answer

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