[SciPy-user] comparisions of fft / inverse fft algorithms

michael biester Michael.Biester at t-online.de
Sun Jan 13 12:45:56 CST 2002


For filter design program I experimented with Fast Fourier Tranforms ( and their inverse).
I used algorithms from the  Numeric module and from Scipy.fft .

It seems, that FFT.fft from Numeric and fft.FFT2.fft perform similar (except for
speed of execution and round off errors)

However when applying the inverse transformations
FFT.inverse_fft(...)  from Numeric

and 

fft.FFT2.ifft

to the same sequence, results are not the same. While 
FFT.inverse_fft(...)  from Numeric performs as expected ( compared with MATLABs ifft() )
fft.FFT2.ifft gives a sequence which is somehow shifted ...

I used this sample script  :



------ sample script ---------------------------------------------------------

#--- test different versions of fft and its inverse

from Numeric import *
import FFT
from scipy import *
import win32com.client

L = 500
N = 512

# create sequences with L complex 1's

x1 = ones(L)*(1+1j)

# use fft from Numeric
y1 = FFT.fft(x1,N)  #  since x1 has L samples transform x1 with zero padding
x1i = FFT.inverse_fft(y1) # transform back

#-- except for round off errors we expect x1i[0:L] = x1[0:L]
#   (indeed they are ...)

# now use fft and inverse fft from Scipy.fft
y2 = fft.FFT2.fft(x1,N)  #  transform x1 with zero padding
x2i = fft.FFT2.ifft(y2)  # transform back

#-- except for round off errors we expect x2i[0:L] = x1[0:L]
#   this time however the samples differ; plotting them reveals that
#   these sequences are similar but shifted versions of each other

--------------------------------------------------------------------------------------------


Regards

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20020113/23c421bf/attachment.html 


More information about the SciPy-user mailing list