What is the relation between FFT length and frequency resolution?

The frequency resolution is dependent on the relationship between the FFT length and the sampling rate of the input signal.

If we collect 8192 samples for the FFT then we will have:

$$\frac{8192\ \text{samples}}{2} = 4096\ \,\text{FFT bins}$$

If our sampling rate is 10 kHz, then the Nyquist-Shannon sampling theorem says that our signal can contain frequency content up to 5 kHz. Then, our frequency bin resolution is:

$$\frac{5\ \text{kHz}}{4096\ \,\text{FFT bins}} \simeq \frac{1.22\ \text{Hz}}{\text{bin}}$$

This is may be the easier way to explain it conceptually but simplified:  your bin resolution is just \$\frac{f_{samp}}{N}\$, where \$f_{samp}\$ is the input signal's sampling rate and N is the number of FFT points used (sample length).

We can see from the above that to get smaller FFT bins we can either run a longer FFT (that is, take more samples at the same rate before running the FFT) or decrease our sampling rate.

The Catch:

There is always a trade-off between temporal resolution and frequency resolution.

In the example above, we need to collect 8192 samples before we can run the FFT, which when sampling at 10 kHz takes 0.82 seconds.

If we tried to get smaller FFT bins by running a longer FFT it would take even longer to collect the needed samples.

That may be OK, it may not be. The important point is that at a fixed sampling rate, increasing frequency resolution decreases temporal resolution. That is the more accurate your measurement in the frequency domain, the less accurate you can be in the time domain. You effectively lose all time information inside the FFT length.

In this example, if a 1999 Hz tone starts and stops in the first half of the 8192 sample FFT and a 2002 Hz tone plays in the second half of the window, we would see both, but they would appear to have occurred at the same time.

You also have to consider processing time. A 8192 point FFT takes some decent processing power. A way to reduce this need is to reduce the sampling rate, which is the second way to increase frequency resolution.

In your example, if you drop your sampling rate to something like 4096 Hz, then you only need a 4096 point FFT to achieve 1 Hz bins *4096 Hz, then you only need a 4096 point FFT to achieve 1hz bins and can still resolve a 2khz signal. This reduces the FFT bin size, but also reduces the bandwidth of the signal.

Ultimately with an FFT there will always be a trade off between frequency resolution and time resolution. You have to perform a bit of a balancing act to reach all goals.


Basic FFT resolution is \$f_s \over N\$, where \$f_s\$ is the sampling frequency.

The ability to differentiate two very closely spaced signals depends strongly on relative amplitudes and the windowing function used.

You may find that playing with the Baudline signal analyzer is a good way to develop some intuition on this matter - and no, running some FFTs and plotting one spectrum at a time in Matlab or Python/Numpy is really not the same.

EDIT: There is also a trick to pad the input with zeros and taking a bigger FFT. It will not improve your differentiation ability but may make the spectrum more readable. It is basically a trick similar to antialiasing in vector graphics.


It's worth noting that an FFT is an alternative to computing a number of separate pairs of sums (k=0..sample_length-1) of Sample[k]*SineRefWave[j][k] and Sample[j]*CosRefWave[j][k], for all j up to half the sample length. If one needs amplitude readouts at all those frequencies, an FFT will compute them all in O(NlgN) time, whereas computing them individually would take O(N^2) time. On the other hand, if one only needs amplitude readouts at a few frequencies, one will often be better off simply computing them individually, especially if one is using a processor or DSP which can efficiently compute that style of sum.

It's also worth noting that while an FFT with e.g. a 20ms sampling window won't be able to distinguish between a single 1975Hz tone, or a combination of frequencies (1975-N)Hz and (1975+N)Hz for N<25, it can be used to measure isolated frequencies with accuracy finer than the sampling window if there is no other spectral content nearby. A lone 1975Hz frequency will pick up equally in the 1950Hz and 2000Hz bins, as would a combination of 1974Hz and 1976Hz tones. An isolated 1974Hz tone, however, would pick up more strongly in the 1950Hz bin than in the 2000Hz bin, and a 1976Hz tone would pick up more strongly in the 2000Hz bin.

Tags:

Dsp