Documentation

cplxpair

年代ort complex numbers into complex conjugate pairs

年代yntax

B = cplxpair(A)
B = cplxpair(A,tol)
B = cplxpair(A,[],dim)
B = cplxpair(A,tol,dim)

Description

B = cplxpair(A)sorts the elements along different dimensions of a complex array, grouping together complex conjugate pairs.

The conjugate pairs are ordered by increasing real part. Within a pair, the element with negative imaginary part comes first. The purely real values are returned following all the complex pairs. The complex conjugate pairs are forced to be exact complex conjugates. A default tolerance of100*epsrelative toabs(A(i))determines which numbers are real and which elements are paired complex conjugates.

IfAis a vector,cplxpair (A)returnsAwith complex conjugate pairs grouped together.

IfAis a matrix,cplxpair (A)returnsAwith its columns sorted and complex conjugates paired.

IfAis a multidimensional array,cplxpair (A)treats the values along the first non-singleton dimension as vectors, returning an array of sorted elements.

B = cplxpair(A,tol)overrides the default tolerance.

B = cplxpair(A,[],dim)sortsAalong the dimension specified by scalar dim.

B = cplxpair(A,tol,dim)sortsAalong the specified dimension and overrides the default tolerance.

Diagnostics

If there are an odd number of complex numbers, or if the complex numbers cannot be grouped into complex conjugate pairs within the tolerance,cplxpairgenerates the error message

Complex numbers can't be paired.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?