Mercurial > hg > octave-nkf
changeset 12541:dd2c70b30f28
Add tests for ifftshift.m
author | Robert T. Short <octave@phaselockedsystems.com.com> |
---|---|
date | Sat, 26 Mar 2011 06:50:12 -0700 |
parents | b3c158b8941c |
children | 32ca4930dec4 |
files | scripts/ChangeLog scripts/signal/ifftshift.m |
diffstat | 2 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2011-03-26 Robert T. Short <octave@phaselockedsystems.com.com> + + * signal/ifftshift.m: Add tests. + 2011-03-26 Robert T. Short <octave@phaselockedsystems.com.com> * signal/fftshift.m: Add tests.
--- a/scripts/signal/ifftshift.m +++ b/scripts/signal/ifftshift.m @@ -71,3 +71,49 @@ endif endfunction + +%!test +%! x = [0:7]; +%! y = ifftshift (x); +%! assert(y, [4 5 6 7 0 1 2 3]); +%! assert(ifftshift (y), x); + +%!test +%! x = [0:6]; +%! y = ifftshift (x); +%! assert(y, [3 4 5 6 0 1 2]); +%! assert(ifftshift (y), [6 0 1 2 3 4 5]); + +%!test +%! x = [0:7]'; +%! y = ifftshift (x); +%! assert(y, [4;5;6;7;0;1;2;3]); +%! assert(ifftshift (y), x); + +%!test +%! x = [0:6]'; +%! y = ifftshift (x); +%! assert(y, [3;4;5;6;0;1;2]); +%! assert(ifftshift (y), [6;0;1;2;3;4;5]); + +%!test +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = ifftshift (x); +%! assert(y, [[7 10 1 4];[9 13 1 5];[2 3 0 1];[4 6 0 2]]); +%! assert(ifftshift (y), x); + +%!test +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = ifftshift (x,1); +%! assert(y, [[1 4 7 10];[1 5 9 13];[0 1 2 3];[0 2 4 6]]); +%! assert(ifftshift (y,1), x); + +%!test +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = ifftshift (x,2); +%! assert(y, [[2 3 0 1];[4 6 0 2];[7 10 1 4];[9 13 1 5]]); +%! assert(ifftshift (y,2), x); +