Mercurial > forge
comparison main/general/ifftshift.m @ 0:6b33357c7561 octave-forge
Initial revision
author | pkienzle |
---|---|
date | Wed, 10 Oct 2001 19:54:49 +0000 |
parents | |
children | 9a986e3452a4 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6b33357c7561 |
---|---|
1 ## Copyright (C) 1997 by Vincent Cautaerts | |
2 ## | |
3 ## This program is free software; you can redistribute it and/or modify | |
4 ## it under the terms of the GNU General Public License as published by | |
5 ## the Free Software Foundation; either version 2, or (at your option) | |
6 ## any later version. | |
7 ## | |
8 ## This program is distributed in the hope that it will be useful, but | |
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 ## General Public License for more details. | |
12 ## | |
13 ## You should have received a copy of the GNU General Public License | |
14 ## along with this file. If not, write to the Free Software Foundation, | |
15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | |
17 ## -*- texinfo -*- | |
18 ## @deftypefn {Function File} {} ifftshift (@var{v}) | |
19 ## Undo the action of the fftshift function. For even length @var{v}, fftshift | |
20 ## is its own inverse, but odd lengths differ slightly. | |
21 ## @end deftypefn | |
22 | |
23 ## Author: Vincent Cautaerts <vincent@comf5.comm.eng.osaka-u.ac.jp> | |
24 ## Created: July 1997 | |
25 ## Adapted-By: jwe | |
26 ## Modified-By: Paul Kienzle, converted from fftshift | |
27 | |
28 function retval = ifftshift (V) | |
29 | |
30 retval = 0; | |
31 | |
32 if (nargin != 1) | |
33 usage ("usage: ifftshift (X)"); | |
34 endif | |
35 | |
36 if (is_vector (V)) | |
37 x = length (V); | |
38 xx = floor (x/2); | |
39 retval = V([xx+1:x, 1:xx]); | |
40 elseif (is_matrix (V)) | |
41 [x, y] = size (V); | |
42 xx = floor (x/2); | |
43 yy = floor (y/2); | |
44 retval = V([xx+1:x, 1:xx], [yy+1:y, 1:yy]); | |
45 else | |
46 error ("ifftshift: expecting vector or matrix argument"); | |
47 endif | |
48 | |
49 endfunction |