I am new to DSP and signal processing in general (digital or analogue). In implementing an FFT/Goertzel I have noticed that the resolution ("bin size" inverse) is directly proportional to the sampling duration. In other words; the tighter you want the resolution, the longer you have to sample for (regardless of sample period / how quickly or slowly you sample (above the Nyquist rate obviously)). Is there any way around this (using some technique other than FFT/Goertzel) or is this an inherent scientific principle? If so then does the principle apply to analogue filters as well? Would a Goertzel algorithm be the best solution for detecting the presence of a particular frequency, with the best resolution (tightest filter)?
4 Answers
For orthogonality of basis vectors, the DFT (or FFT) basis vectors all have a different but exact integer number of full cycles in the DFT length, e.g. if the FFT result bin for one basis vector has K full cycles, the next bin up will be for K+1 full cycles.
So if you want a DFT to separate 2 frequencies of sinusoids, the closer they are in frequency, the longer a time interval it takes for the two waveforms to become separated by exactly 1 full period or cycle, the longer a DFT (of FFT, or Goertzel, or wavelet, etc.) it takes to fit that time interval for measurement, and have at least a full result bin of separation.
Even if you don’t want to wait until two frequencies of sinusoids differ by one full cycle, say there is so little noise that you can tell apart 2 the sinusoids if they differ by only 0.1 degree (pi/1800.0) of phase change within some window, the rule still applies. The closer the 2 frequencies are that you want to tell apart or resolve, the longer you will have to wait for them to differ by that 0.1 degree of phase shift or change that you can barely detect (regression fit within some statistical error bound or distribution, etc.)
Otherwise you can’t tell them apart, and thus claim a resolution or level of accuracy that can.
And the more noise, the bigger the difference you will have to wait for (maybe more than 1 degree, maybe even up to more than 2 full periods of difference within the measurement time window).
Note that even with analog filters (or IIRs), generally the narrower the bandwidth, the higher the Q, the longer the impulse response, thus the longer the measurement delay to respond to or detect that narrower frequency range.
So the “tightest” fit requires either more time, and/or low noise (including interference and measurement error), or a very high signal-to-noise ratio (or of the assumption of such, and hope that that assumption is actually correct.)
-
$\begingroup$ Do you have any further information or a link available regarding impulse response / measurement delay in an analogue filter? $\endgroup$– DaneAug 5, 2019 at 8:48
First, keep in mind that, DFT/FFT spectral resolution and DFT frequency spacing are not the same things. Given a fixed length recording, you can easily change your DFT bin frequency spacing by performing arbitrary length FFTs on the given data. But this will not change your spectral resolution, which is limited by the initial data length. Rroughly speaking, the longer your total observation interval is, the better (finer) your spectral resolution will be...
Consider the following discrere-time Fourier transform property :
$$ x[n]w[n] \longleftrightarrow X(e^{j\omega}) \underset{2\pi}{\underset{-} \star} W(e^{j\omega}) $$
The finite length sequence $w[n]$, which multiplies $x[n]$, is called as the window, and represents the observation interval of $x[n]$. Its reflection into the frequency-domain is a convolution, in frequency, of the true input spectrum, $X(e^{j\omega})$, by the window's spectrum $W(e^{j\omega})$. This convolution results in a smearing of the input's spectrum; a.k.a. the loss of the input spectral resolution.
If you had an infinite length (say rectangular) observation, then you would have (without scales):
- $ x[n]w[n] \longrightarrow x[n] $
- $W(e^{j \omega}) \longrightarrow \delta(\omega) $
- $X(e^{j \omega}) \star W(e^{j \omega}) \longrightarrow X(e^{j \omega})$
The spectral resolution attainable under FFT/DFT transforms basicaly follows this theoretical limitation.
Goertzel algorithm is also limited by this fact. It's an efficient method of computing a small number of arbitrary frequencies compared to the whole spectrum computed by DFT.
The easiest way to understand these relationships in an intuitive way is to start with the first rule of DFTs:
The bin index is the frequency in units of cycles per frame.
Period. It doesn't matter how many samples you take.
Suppose you have tones at bins 4 and 5. Now, double your interval. Those tones are now at bins 8 and 10. So, increasing your interval increased the spacing of the bins.
Increasing the number of samples with a fixed interval moves where the Nyquist frequency is. If you have 100 samples, the Nyquist is at 50 cycles per frame. If you double that to 200 samples, the Nyquist moves to 100 cycles per frame. A tone of 60 cycles per frame would appear as an alias of 40 cycles per frame in the first case, but be correctly identified as 60 in the second.
The Nyquist frequency is independent of the frame size. It occurs at two samples per cycle, which is the same as $\pi$ radians per sample.
It's not strictly true, if you have additional information about the signal. For instance, your FFT works for input signals that are have an upper band limit at the Nyquist frequency, but can start at DC. But what if you know that your input signal also has a minimum frequency?
Still, while this can be used to disprove the exact formulation of the title question, the basic fact holds that the more information you have about a signal (in the time domain), the more information you have about that signal (in the frequency domain). Measuring the input over a longer time is one obvious method to gain more data.