Function File: [zc, zr] = cplxreal (z)
Function File: [zc, zr] = cplxreal (z, tol)
Function File: [zc, zr] = cplxreal (z, tol, dim)

Sort the numbers z into complex-conjugate-valued and real-valued elements. The positive imaginary complex numbers of each complex conjugate pair are returned in zc and the real numbers are returned in zr.

tol is a weighting factor in the range [0, 1) which determines the tolerance of the matching. The default value is 100 * eps and the resulting tolerance for a given complex pair is tol * abs (z(i))).

By default the complex pairs are sorted along the first non-singleton dimension of z. If dim is specified, then the complex pairs are sorted along this dimension.

Signal an error if some complex numbers could not be paired. Signal an error if all complex numbers are not exact conjugates (to within tol). Note that there is no defined order for pairs with identical real parts but differing imaginary parts.

See also: cplxpair.

Package: signal