home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / utils / mathstud / ifft.m < prev    next >
Encoding:
Text File  |  1995-05-19  |  467 b   |  29 lines

  1. function y=ifft(x,n)
  2. %y=ifft(x,n)
  3. %computes the inverse FFT of the input array, x
  4. %n specifies the size of the required transform
  5.  
  6. %       S.Halevy 7/31/92
  7. %       Copyright (c) 1992 by the MathWizards
  8.  
  9. if ~isvector(x)
  10.    error('input argument should be a vector')
  11. end
  12.  
  13. [xm,xn]=size(x);
  14. x=x(:);
  15.  
  16. if nargin > 1
  17.    nx = length(x);
  18.    if nx > n
  19.       x=x(1:n);
  20.    else
  21.       x(n)=0;
  22.    end
  23. end
  24.  
  25. y=_ifft(x)/length(x);
  26. if xn > xm
  27.    y=y.';
  28. end
  29.