Symbolic polar angle
Compute the polar angles of these complex numbers. Because these numbers are not symbolic objects, you get floating-point results.
[angle(1 + i), angle(4 + pi*i), angle(Inf + Inf*i)]
ans = 0.7854 0.6658 0.7854
Compute the polar angles of these complex numbers which are converted to symbolic objects:
[angle(sym(1) + i), angle(sym(4) + sym(pi)*i), angle(Inf + sym(Inf)*i)]
ans = [ pi/4, atan(pi/4), pi/4]
Compute the limits of these symbolic expressions:
syms x limit(angle(x + x^2*i/(1 + x)), x, -Inf) limit(angle(x + x^2*i/(1 + x)), x, Inf)
ans = -(3*pi)/4 ans = pi/4
Compute the polar angles of the elements of matrixZ
:
Z = sym([sqrt(3) + 3*i, 3 + sqrt(3)*i; 1 + i, i]); angle(Z)
ans = [ pi/3, pi/6] [ pi/4, pi/2]
Callingangle
for numbers (or vectors or matrices of numbers) that are not symbolic objects invokes the MATLAB®angle
function.
IfZ = 0
, thenangle(Z)
returns0
.
For realX
andY
such thatZ = X + Y*i
, the callangle(Z)
相当于atan2(Y,X)
.