angle

Phase angle of complex numbers.

Category: Mathematics > Elementary Math

Syntax

P = angle(Z)

Returns the phase angle of each element of Z, in radians.

Description

angle(Z) is the same as atan2(imag(Z), real(Z)): the counterclockwise angle between the positive real axis and the point in the complex plane. A negative real number has an angle of pi, a positive real number has an angle of 0. Together with abs, it gives the polar form Z = abs(Z) .* exp(1i*angle(Z)).

Input arguments

Z
Numeric array. Complex values are typical.

Output arguments

P
Real array of the same size, with values in [-pi, pi].

Example

Phase of complex numbers

angle(1 + 1i)
angle(-1)
angle([1i -1i 2])
Output
ans = 0.7854
ans = 3.1416
ans = 1×3

    1.5708   -1.5708         0

See also

abs atan2 real imag unwrap