angle
argument of complex numbers, in radians
Syntax
A = angle(Z)
Arguments
- Z
- Array of real or complex numbers.
- A
- Array of real numbers in (-π,π], of size(Z): the arguments (phases) of respective Z elements, in radians.
Description
angle(Z)
computes and returns the arguments of given complex numbers.
Special cases:
angle(0)
is0
.- For any
Z
element whose real or an imaginary of both parts is%nan
,angle(Z)
is%nan
. - For any
Z
element whose both real and imaginary parts are infinite (positive or negative),angle(Z)
is%nan
.
Examples
// Real axis angle([-%inf -2 -1 0 1 2 %inf]) // Imaginary axis z = complex(zeros(1,7), [-%inf -2 -1 0 1 2 %inf]) angle(z) // Real = Imag z = complex([-%inf -2 -1 0 1 2 %inf], [-%inf -2 -1 0 1 2 %inf]) angle(z) // Real>0 = -Imag z = complex([0 1 2 %inf], [0 -1 -2 -%inf]) angle(z) // Real<0 = -Imag z = complex(-[0 1 2 %inf], [0 1 2 %inf]) angle(z)
--> // Real axis --> angle([-%inf -2 -1 0 1 2 %inf]) ans = 3.1415927 3.1415927 3.1415927 0. 0. 0. 0. --> // Imaginary axis --> z = complex(zeros(1,7),[-%inf -2 -1 0 1 2 %inf]) z = 0. - Infi 0. - 2.i 0. - i 0. + 0.i 0. + i 0. + 2.i 0. + Infi --> angle(z) ans = -1.5707963 -1.5707963 -1.5707963 0. 1.5707963 1.5707963 1.5707963 --> // Real = Imag --> z = complex([-%inf -2 -1 0 1 2 %inf], [-%inf -2 -1 0 1 2 %inf]) z = -Inf - Infi -2. - 2.i -1. - i 0. + 0.i 1. + i 2. + 2.i Inf + Infi --> angle(z) ans = Nan -2.3561945 -2.3561945 0. 0.7853982 0.7853982 Nan --> // Real>0 = -Imag --> z = complex([0 1 2 %inf], [0 -1 -2 -%inf]) z = 0. + 0.i 1. - i 2. - 2.i Inf - Infi --> angle(z) ans = 0. -0.7853982 -0.7853982 Nan --> // Real<0 = -Imag --> z = complex(-[0 1 2 %inf], [0 1 2 %inf]) z = 0. + 0.i -1. + i -2. + 2.i -Inf + Infi --> angle(z) ans = 0. 2.3561945 2.3561945 Nan
See also
- abs — absolute value, magnitude
History
Version | Description |
2023.1 | angle() introduced. |
Report an issue | ||
<< Complex numbers | Complex numbers | complex >> |