Skip to Main Content Skip to Search
Product Documentation

complex - Construct complex fi object from real and imaginary parts

Syntax

c = complex(a,b)
c = complex(a)

Description

The complex function constructs a complex fi object from real and imaginary parts.

c = complex(a,b) returns the complex result a + bi, where a and b are identically sized real N-D arrays, matrices, or scalars of the same data type. When b is all zero, c is complex with an all-zero imaginary part. This is in contrast to the addition of a + 0i, which returns a strictly real result.

c = complex(a) for a real fi object a returns the complex result a + bi with real part a and an all-zero imaginary part. Even though its imaginary part is all zero, c is complex.

The output fi object c has the same numerictype and fimath properties as the input fi object a. If a is associated with the global fimath, the output fi object c is also associated with the global fimath.

See Also

imag | real

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS