MATLAB: Do FFT results need to be scaled if the chebwin MATLAB function is used to window the data

chebwin

Hello,
I used the chebwin MATLAB function on residuals that I fed into an FFT. The windowing helped reduce the noise; however, I am unsure if I have to scale the results due to using this type of window to retrieve any amplitude information that could have been lost. If so, why, and how would I go about doing it?
I included some fft code below. Any help is much appreciated.
nfft = 2^16;
len = length(res);
fs = 10;
windowy = chebwin(len,75);
w = res .* windowy;
y = fft(w,nfft)/nfft;
yy = abs(y(1:nfft));
freq = fs*(0:(nfft)-1)/nfft;
figure;
loglog(freq(1:nfft/2), yy(1:nfft/2));
Thanks,
-C

Best Answer

It is generally not necessary to adjust anything as the result of using a window.
However there are two errors in your code that might result in the amplitude not being correct.
You should divide by ‘len’, not ‘nfft’ here:
y = fft(w,nfft)/len;
and multiply by 2 here:
loglog(freq(1:nfft/2), yy(1:nfft/2)*2);
That should produce the correct scaling.