complex

Purpose

Converts a pair of real matrices to a complex matrix.

Format

z = complex(xr, xi)
Parameters:
  • xr (NxK real matrix) – the real elements of z.
  • xi (NxK real matrix or scalar) – the imaginary elements of z.
Returns:

z (NxK complex matrix) –

Examples

// The real elements
xr = { 4 6,
       9 8 };

// The imaginary elements
xi = { 3 5,
       1 7 };

z = complex(xr, xi);

After the code above, z will be equal to:

4 + 3i   6 + 5i
9 + 1i   8 + 7i

See also

Functions imag(), real()