angle

Symbolic polar angle

Syntax

Description

example

angle(Z)computes the polar angle of the complex valueZ.

Examples

Compute Polar Angle of Numeric Inputs

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 Polar Angle of Symbolic Inputs

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 Polar Angle of Symbolic Expressions

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 Polar Angle of Array

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]

Input Arguments

collapse all

Input, specified as a number, vector, matrix, array, or a symbolic number, variable, expression, function.

Tips

  • Callinganglefor numbers (or vectors or matrices of numbers) that are not symbolic objects invokes the MATLAB®anglefunction.

  • IfZ = 0, thenangle(Z)returns0.

Alternatives

For realXandYsuch thatZ = X + Y*i, the callangle(Z)相当于atan2(Y,X).

Introduced in R2013a