The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Sep 27th, 2024, 6:30am
Pages: 1
Send Topic Print
Help needed about Matlab's windowed fft precision! (Read 2214 times)
greatqs
Junior Member
**
Offline



Posts: 11

Help needed about Matlab's windowed fft precision!
Jul 15th, 2007, 2:23am
 
Hi everybody,


I've met a weird problem really makes me desperate.

The problem is as below,

As we know, hann window's spectrum is defined as[1]:
W(phi)=0.5*D(phi)+0.25(D(phi-2*pi/N)+D(phi+2*pi/N))
where, D(phi)=exp(j*phi)*sin(N/2*phi)/sin(1/2*phi) is the Dirichlet kernel, and N is number of DFT points
the amplitude of spectrum at the first fft bin (phi=0) should be N/2
the amplitude of spectrum at the second and last fft bin (phi=1*2pi/N and phi=(N-1)/N*2pi) should be N/4
the amplitude of spectrum at the rest of fft bins should be 0
hence, in theory, there should be 3 non-zero bins on the spectrum of hann window.

But when I do this in Matlab, I found that the rest of fft bins' amplitude is not so small that it cannot be simply neglected.
As can be seen from the picture in the attachment

for N=1024, the first and second bin's amplitude is 0dB and -6dB as expected, but the rest bins' amplitude are not

zero as theory says (they are around -70dB~-80dB).
The consequence of this problem is that when I do fft with any sine wave plus noise of which the noise floor is below these non-signal bins' amplitude (for example the noise floor is around -100dB), Matlab simply gives me the wrong SNR!!

I can not find any answers or related information from any textbook. I guess it is caused by Matlab fft's internal precision.

Anyone has idea about this?


Thanks a lot!
 
[1] "On the use of windows for harmonic analysis with the discrete fourier transform", F. J. Harris, Proceedings of the IEEE VOL.66 NO.1, Jan. 1978
 
the matlab script I used (I'm using Matlab R2006b):

close all;
nbpts=1024;
w=hann(nbpts);                  % generates hanning window vectors
W=fft(w)/sum(w);            % generates normalized fft spectrum
WM=abs(W);                  % gets amplitude spectrum                  
figure(1);
plot([1:nbpts],20*log10(WM),'bo-');
xlabel('fft bin');
ylabel('dB');
title('Hann window DFT with N=1024 normalized spectrum');
grid on;
Back to top
 

hann_window_dft_spectrum.jpg
View Profile   IP Logged
vivkr
Community Fellow
*****
Offline



Posts: 780

Re: Help needed about Matlab's windowed fft precis
Reply #1 - Jul 16th, 2007, 2:57am
 
Hi,

The internal precision of MATLAB is quite high. I think you have misinterpreted the properties of the window you are
using, and mistaking the "main lobe width" for the number of nonzero bins. I don't think there is any window which
would have the excellent properties you seek.

Nevertheless, depending on the input signal which is operated on by the window, you may end up with just a finite number
of nonzero bins.

Regards
Vivek
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.