atan2
Symbolic four-quadrant inverse tangent
Syntax
Description
computes the four-quadrant inverse tangent (arctangent) of
P
= atan2(Y
,X
)Y
and X
.
Symbolic arguments X
and Y
are assumed to be real,
and atan2(Y,X)
returns values in the interval
[-pi,pi]
.
Examples
Input Arguments
More About
Tips
Calling
atan2
for numbers (or vectors or matrices of numbers) that are not symbolic objects invokes the MATLAB®atan2
function.If one of the arguments
X
andY
is a vector or a matrix, and another one is a scalar, thenatan2
expands the scalar into a vector or a matrix of the same length with all elements equal to that scalar.If
X = 0
andY > 0
, thenatan2(Y,X)
returnspi/2
.If
X = 0
andY < 0
, thenatan2(Y,X)
returns-pi/2
.If
X = Y = 0
, thenatan2(Y,X)
returns0
.
Alternatives
For complex Z = X + Y*i
, the call atan2(Y,X)
is
equivalent to angle(Z)
.
Version History
Introduced in R2013a