diff options
author | Rashmi Patankar | 2025-04-30 15:01:49 +0530 |
---|---|---|
committer | GitHub | 2025-04-30 15:01:49 +0530 |
commit | 0495a12104d8466509769fc34271757f00577709 (patch) | |
tree | cb208dd421d39051d85f4ef0476c9208ef2c41ab /macros/cplxpair.sci | |
parent | a0bff158d21c2c12a12781bc5019f3a45bd866b2 (diff) | |
parent | ec6379e7494ff4ca2dc7c7524013d109be450bae (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-master.tar.gz FOSSEE-Signal-Processing-Toolbox-master.tar.bz2 FOSSEE-Signal-Processing-Toolbox-master.zip |
Fixed Failing test scripts
Diffstat (limited to 'macros/cplxpair.sci')
-rw-r--r-- | macros/cplxpair.sci | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/macros/cplxpair.sci b/macros/cplxpair.sci index 16fceac..d7e8a38 100644 --- a/macros/cplxpair.sci +++ b/macros/cplxpair.sci @@ -1,30 +1,30 @@ -/*Description - Sort the numbers z into complex conjugate pairs ordered by increasing real part. - The negative imaginary complex numbers are placed first within each pair. All real numbers (those with abs (imag (z) / z) < tol) are placed after the complex pairs. - and the resulting tolerance for a given complex pair is 100 * eps (abs (z(i))). - 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 -Calling Sequence - cplxpair (z) - cplxpair (z, tol) - cplxpair (z, tol, dim) -Parameters: - z is a matrix or vector. - tol is a weighting factor which determines the tolerance of matching. The default value is 100. - 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. -Dependencies: ipermute -Example: - The following code - [ cplxpair(exp(2*%i*%pi*[0:4]'/5)), exp(2*%i*%pi*[3; 2; 4; 1; 0]/5) ] - Produces the following output - ans = - -0.80902 - 0.58779i -0.80902 - 0.58779i - -0.80902 + 0.58779i -0.80902 + 0.58779i - 0.30902 - 0.95106i 0.30902 - 0.95106i - 0.30902 + 0.95106i 0.30902 + 0.95106i - 1.00000 + 0.00000i 1.00000 + 0.00000i -*/ function zsort = cplxpair (z, tol, dim) +// Description +// Sort the numbers z into complex conjugate pairs ordered by increasing real part. +// The negative imaginary complex numbers are placed first within each pair. All real numbers (those with abs (imag (z) / z) < tol) are placed after the complex pairs. +// and the resulting tolerance for a given complex pair is 100 * eps (abs (z(i))). +// 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 +// Calling Sequence +// cplxpair (z) +// cplxpair (z, tol) +// cplxpair (z, tol, dim) +// Parameters: +// z is a matrix or vector. +// tol is a weighting factor which determines the tolerance of matching. The default value is 100. +// 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. +// Dependencies: ipermute +// Example: +// The following code +// [ cplxpair(exp(2*%i*%pi*[0:4]'/5)), exp(2*%i*%pi*[3; 2; 4; 1; 0]/5) ] +// Produces the following output +// ans = +// -0.80902 - 0.58779i -0.80902 - 0.58779i +// -0.80902 + 0.58779i -0.80902 + 0.58779i +// 0.30902 - 0.95106i 0.30902 - 0.95106i +// 0.30902 + 0.95106i 0.30902 + 0.95106i +// 1.00000 + 0.00000i 1.00000 + 0.00000i + if (nargin < 1) error("Invalid inputs"); end |