MATLAB Function Reference    

Construct complex data from real and imaginary components



c = complex(a,b) creates a complex output, c, from the two real inputs.

The output is the same size as the inputs, which must be scalars or equally sized vectors, matrices, or multi-dimensional arrays of the same data type.

c = complex(a) for real a returns the complex result c with real part a and 0 as the value of all imaginary components. Even though the value of all imaginary components is 0, c is complex and isreal(c) returns false.

The complex function provides a useful substitute for expressions such as

in cases when the names "i" and "j" may be used for other variables (and do not equal ), when a and b are not double-precision, or when b is all zero.


Create complex uint8 vector from two real uint8 vectors.

See Also

abs, angle, conj, i, imag, isreal, j, real

  compass computer