This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Sort complex numbers into complex conjugate pairs


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


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 of 100*eps relative to abs(A(i)) determines which numbers are real and which elements are paired complex conjugates.

If A is a vector, cplxpair(A) returns A with complex conjugate pairs grouped together.

If A is a matrix, cplxpair(A) returns A with its columns sorted and complex conjugates paired.

If A is 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) sorts A along the dimension specified by scalar dim.

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


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

Complex numbers can't be paired.

Introduced before R2006a

Was this topic helpful?