Hi Felix This doesn't look quite right: # Re-Transform to frequency domain fftdata = fftpack.fft(ifftdata) fftdata = fftpack.fftshift(ifftdata) # not the "i" You probably want fftshift(fft(ifftdata))? As an aside, you also don't need vectorise, since those functions are all "vectorised" by themselves. Cheers Stéfan 2008/7/25 Felix Richter <felix@physik3.uni-rostock.de>:
Hi all,
I found myself busy today trying to understand what went wrong in my FFT code. I wrote a minimal example/testing code to check the FFT output against an analytic result and also tried to reverse the transformation to get the original function back. Most curiously, the results depend on whether I first do the fft and then the ifft or the other way round.
For the test function, I use the Lorentz function 1/(x^2+1). The exact FT is exp(-|t|)*sqrt(pi/2), the IFT yields the same.
1) First FFT and then IFFT: The real part of FFT oscillates, the imaginary part is not zero, and the magnitudes do not match. All this should not be, but the IFFT reproduces the original function just fine.