Comparison between numerical precision in FFT and manual FT: both error plots show very different behavior

Hi, I was hoping someone could help me understand the effects of the numerical precision in Matlab's FFT. I setup a very simple code that perform the FFT and IFFT and compare my results to an FFT follwoed by a "manual" IFFT, I see a very strange increasing behavioir in the error and was wondering what this was due to. The fact that it increases with the sample number leads me to believe it's related to the index but I am not sure how I can mitigate this problem.
CODE:
N = 2^13;
x = rand(N,1);
xk = fft(x,N);
y = ifft(xk,N);
yr = zeros(N,1);
for k=1:N
yr = yr + xk(k)*exp(1i*2*pi*[0:N-1].'*(k-1)/N);
end
figure;
plot(abs(yr/N-x))
title 'hand ifft'
figure;
plot(abs(x-y))
title 'ifft'
Could it be the constants values? how does fftw actually handle these numbers.
Thanks for the help.
Alex

4 comentarios

I find this to be a very interesting observation, too. Incidentally, what do you mean by "constant values"?
Hi Elige, constants refers to the values of 'pi' and 'e', not sure if when I use FFT by "hand" they take on certain values but when I use FFT, which uses fftw they are different.
The same trends can be observed in FFT based routines such as the CZT.m (chirp Z transform)
Here is a link I got from Kevin McGee (thanks!) :
http://www.fftw.org/accuracy/comments.html
but still more work needs to be done to determine exactly where the problem is.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.

Preguntada:

el 1 de Jun. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by