Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Français


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) is 0.
  • 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 — valeur absolue ou module

History

VersionDescription
2023.1 angle() introduced.
Report an issue
<< Nombres complexes Nombres complexes complex >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:15:57 CEST 2024