complex

Creates an complex number.

Syntax

  • cpx = complex(a)

  • cpx = complex(a, b)

Input argument

  • a - a variable: real part

  • b - a variable: imaginary part

Output argument

  • cplx - result of a + b*i

Description

complex returns a complex value from real arguments.

With only one input argument, complex returns a complex value a + 0*i.

Example

z = complex(3, 2)
z2 = complex(Inf, Inf)
z3 = Inf + Inf * i

See also

real, imag.

History

Author

Allan CORNET

Last updated