Trying to find error value in FFT compuation
Mostrar comentarios más antiguos
I am trying to compute the error in my FFT code.
clear vars
close all
M = 128;
cutoff = .05;
a = -5;
b = 5;
zeroed = 5;
x = linspace(a,b, M);
y = 1 ./ (1 + x.*x);
Y = fft(y);
YY = fft(y);
PSD = Y.*conj(Y);
freq = 1/(b-a) * (0:M-1);
cratio = 100* zeroed/M;
YYinv = ifft(YY);
errYYinv = ;
plot( x,y,'k', x,YYinv,'r' )
title('data y (black) and compressed YYinv (red)')
pause
id = fopen('out-compress','a');
fprintf( id,'# M=%i samples of Runge function \n', M );
fprintf( id,'# cutoff errYYinv zeroed cratio \n' );
fprintf( id,' %.2f %.2e %4i %.0f \n', cutoff, errYYinv, zeroed, cratio);
fclose(id);
plot( freq, PSD );
title('Power Spectrum Density (PSD) distribution vs frequency');
pause
Yinv = ifft(Y);
plot( x,y, x,Yinv,'o' )
title('data y and their iFFT: Yinv (o)');
pause
Respuestas (1)
Categorías
Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!