atan2
The four-quadrant inverse tangent function
(p)=atan2(y,x)
(p)=atan2(y,x,deg)
| Inputs |
x |
A real array. The arary ofy-coordinates of points. |
b |
A real array of the same size as a .The array of x-coordinates of points. |
deg |
Optional input. |
| Outputs |
p |
A real array of the same size as a . |
Description
For each pair (yi,xi) of elements of (y,x) ,
the corresponding element of the output p
is the angle between the
x-axis and the vector pointing from the
origin to the point (xi,yi).
If the optional argument deg is given any value ,
the angles are returned in degrees ; otherwise the
angles are in radians.
Example
>>atan2(2,0,1)
90
>>atan2(2,2)
0.7854
>>atan2(2,-2,1)
135
>>atan2(-2,2,1)
-45
>>atan2(-1,0,1)
-90