P = atan2(Y,X)
atan2(Y,X)
returns a matrix P
the same size as X
and Y
containing the element-by-element, four-quadrant arctangent of the real parts of Y
and X
. Any imaginary parts are ignored.
Elements of P
are in the interval [-pi, pi]
. The specific quartile is determined by sign(Y)
and sign(X)
:
This contrasts with the result of atan(Y/X)
, which is limited to the interval [-pi/2, pi/2]
, or the right side of this diagram.
Thenr = abs(z)
theta = atan2(imag(z),real(z))
z
is equal to
This is a common operation, so MATLAB provides a function,r
*exp(i
*theta)
angle(z)
, that simply computes atan2(imag(z),real(z))
.
abs
,angle
,cos
,funm
,sin
,tan
(c) Copyright 1994 by The MathWorks, Inc.