File Exchange

image thumbnail

atan2(0..360)

version 1.0 (1.26 KB) by

Function calculates the arc tangent of y/x and places the result in range of [0..360]

2 Downloads

Updated

View License

Function calculates the arc tangent of y/x and places the result in range of [0..360].
To find similar examples and resources please visit www.smallsats.org

Comments and Ratings (2)

Michael Völker

Where MATLAB's atan2d() is already present, only a single line is required to make the result [0...360]:

ang = mod( atan2d(y,x), 360 );

If atan2d() is not present but atan2() is, it is sufficient to use

ang = mod( atan2(y,x) .* 180./pi, 360 );

And if somehow neither atan2() nor atan2d() were present and they had to be implemented manually, I would expect them to behave like the original functions.

The most important lack of function is the inability to work on arrays.

Richard Zapor

atan2d exists in R2012B and gives 0:180 and 0:-180.
Thus to get [0:360) is two lines
ang=atan2d(y,x);
if ang<0,ang=ang+360;end

MATLAB Release
MATLAB 7.10 (R2010a)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video