In theory of FT(Fourier transform) and STFT(Short Time Fourier Transform) it is said that "A wide window gives better frequency resolution but poor time resolution. A narrower window gives good time resolution but poor frequency resolution"

Can somebody explain why a narrower window gives poor frequency resolution?


3 Answers 3


The other answers are good, but I thought that I would try to give a more intuitive/visual answer since I am an intuitive/visual guy.

The picture below is the plot of two tones that are almost the same frequency. One tone is plotted in red, and the other in blue.

Short window

I generated the picture in Matlab with the following code:

tone1 = sin(2*pi*.05 * (0:99));
tone2 = sin(2*pi*.0501 * (0:99));
hold on
plot(tone2, 'r')

As you can see from both the picture and the code, the two tones are very close in frequency. They are starting to separate a bit towards the end of this short window, but they are still very similar, to the point where a DFT could not tell them apart.

If I create the same tones with the same frequencies, only I make the window longer (5000 samples this time instead of 100) we get a much different picture. Obviously there will be more cycles in each tone...

Long window

... but that's not the interesting part. We see the interesting part when we zoom in at the end of the window.

Long window zoom

We see that the two tones are 180 degrees out of phase at the end of the window, which makes them very easy to distinguish. So how did I know to pick 5000 samples? The difference in the two tones is $.0002\pi \frac{radians}{sample}$, so $5000$ samples $* .0002\pi \frac{radians}{sample} = \pi$ radians.

As another answer mentioned, the resolution of the DFT is the sample frequency divided by the number of samples (i.e. the window length). I implicitly made the sample frequency 1, so if we divide 1 by 5000 (the number of samples), we get that the resolution is .0002 Hz. Our tones actually differ by .0001 Hz, meaning that tone2 will have energy in both tone1's bin and the bin next to it (and a little bit in all the others too, but that's a different story).


It's the uncertainty principle.



When calculating the frequency resolution, or bin width, of a DFT the formula is as follows:

frequency_resolution = sample_rate/fft_size

Let's say you have a 8000 Hz sample rate audio signal, but you want really high frequency resolution. You only have 8000 samples for one second, but you want to take a 32K FFT to get a really high frequency resolution. When you take a 32K FFT of a sequence of 8000 samples you need to pad the sequence with a ton of zeros in order to fill the FFT. There's no added value from doing this, so while you get a high resolution in the frequency domain, there's not enough sample support so it's just interpolated data. The frequency domain plot is smooth and interpolated.

Now say you have a lot of data, but a lot of data takes time to fill the FFT register. Say your sample rate is 8000, but you want really high resolution and your going to wait for it. You wait 4 seconds to fill that 32K FFT. Now when you take that FFT there's no extra padding of zeros to fill it. So when you look at the plot those bins are not interpolated, but supported by a lot of data because you waited for it.

That's the difference. When you have a long FFT with low sample support you get interpolated data. So that's the time-frequency trade-off you speak of. If you want high resolution, you need data to support it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.