|MATLAB Function Reference|
Four-quadrant inverse tangent
P = atan2(Y,X)
returns an array
P the same size as
Y containing the element-by-element, four-quadrant inverse tangent (arctangent) of the real parts of
X. The elements of
P are in the interval . Any imaginary parts of the inputs are ignored.
P lie in the closed interval
pi is the MATLAB floating-point representation of .
sign(X) to determine the specific quadrant.
atan2(Y,X) contrasts with
atan(Y/X), whose results are limited to the interval , or the right side of this diagram.
Any complex number is converted to polar coordinates with
This is a common operation, so MATLAB provides a function,
angle(z), that computes
theta = atan2(imag(z),real(z)).
To convert back to the original complex number
atan2 uses FDLIBM, which was developed at SunSoft, a Sun Microsystems, Inc. business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org.
© 1994-2005 The MathWorks, Inc.