Symbolic fourquadrant inverse tangent
atan2(Y,X)
atan2(
computes
the fourquadrant inverse tangent (arctangent) of Y
,X
)Y
and X
.
If Y
and X
are vectors or
matrices, atan2
computes arctangents element by
element.

Symbolic number, variable, expression, function. The function
also accepts a vector or matrix of symbolic numbers, variables, expressions,
functions. If 

Symbolic number, variable, expression, function. The function
also accepts a vector or matrix of symbolic numbers, variables, expressions,
functions. If 
Compute the arctangents of these parameters. Because these numbers are not symbolic objects, you get floatingpoint results.
[atan2(1, 1), atan2(pi, 4), atan2(Inf, Inf)]
ans = 0.7854 0.6658 0.7854
Compute the arctangents of these parameters which are converted to symbolic objects:
[atan2(sym(1), 1), atan2(sym(pi), sym(4)), atan2(Inf, sym(Inf))]
ans = [ pi/4, atan(pi/4), pi/4]
Compute the limits of this symbolic expression:
syms x limit(atan2(x^2/(1 + x), x), x, Inf) limit(atan2(x^2/(1 + x), x), x, Inf)
ans = (3*pi)/4 ans = pi/4
Compute the arctangents of the elements of matrices Y
and X
:
Y = sym([3 sqrt(3); 1 1]); X = sym([sqrt(3) 3; 1 0]); atan2(Y, X)
ans = [ pi/3, pi/6] [ pi/4, pi/2]
For complex Z = X + Y*i
, the call atan2(Y,X)
is
equivalent to angle(Z)
.