spectral leakage using built-in fft
Show older comments
Hi,
I've been using matlab's built-in fft(), and spectral leakage has been a problem. However, my colleague, who's been using FORTRAN code straight out of Numerical Recipes in FORTRAN 77, did not get any spectral leakage whatsoever. I've checked, and his code does not apply any windowing. Without access to the actual code of the built-in function it's hard for me to determine the reason for this difference. What do you think it is?
My code, which is sampled almost directly from an example on the mathworks website
%FOR ALL i FILES IN THE FILE LIST temp=importdata([workdir, files(i).name]); file=temp.data;
time = file(:,1);
U=file(:,2);
npoints=length(time);
f = FS/2*linspace(0,1,NFFT/2+1);
fftu= fft(U,NFFT)/npoints;
NFFT=2^nextpow2(npoints);
Uf=2*abs(fftu(1:NFFT/2+1));
%PLOT Uf as function of f
Thanks! Tale
Answers (0)
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!