Hi guys, thanks for this website, its very useful and interesting
I'm a student and still struggling to understand many of this complexities about frequency resolution and dsp and I still haven't got a clear picture of all the factors that come into play when I'm trying to achieve the best freq. resolution within a window type, specially when there are two closed spaced signals.
What is really important in this case? The spacing between them/ 6dB limit? the window size? their amplitudes? thanks.
The biggest thing and the easiest to remember (for me at least) is the time span. The resolution is the reciprocal of the time span. So, that means: "the window size" most of the time.
If the time span is fixed then increasing N won't help as this simply increases the sample rate but not the time span. If the FFT is interpolated, this won't help much either because, while it increases the apparent time span, it does it by repeating the same samples in time. Example: Take a time series and compute the FFT. Then double the time series by repeating it and compute the FFT. The result is an FFT with half the frequency interval between samples but with no greater spectral resolution really. It just looks like it.
Even when you say "the best frequency resolution", the answer isn't much different than the time span or the window length. I'd say, for practical purposes, not at all. Consider a bandpass filter: The sharpest edges are determined by the time span or window length. That's a fundamental limit. (There's a thing called "supergaining" but not generally encountered in DSP and somewhat messy.)
Most window designs are intended to minimize the sidelobes or stopband character. One can design a window to have equiripple outside the main lobe or fast decay outside the main lobe (with a wider main lobe), etc.
There are particular algorithms for separating closely-spaced frequencies. I don't recall the name(s) right now....
Are you familiar with the paper by Fred Harris called "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform"? This paper goes through a number of the issues one should consider when trying to detect multiple signals in an FFT. (As the previous responder mentioned, I am assuming that you are trying to detect / distinguish individual signals in FFT / DFT outputs.) Some key items:
1.) Different windowing techniques will tend to "fatten" the signal; i.e., the peak energy will bleed into adjoining bins.
2.) The power levels of the side lobes of the frequency spectrum will differ for different windows. With no windowing the first side lobe will be only 13 dB the peak, which can impact your ability to find weaker signals near a stronger signal.
3.) Likewise the "fall off" of the additional sidelobes can have similar impacts on finding weaker signals.
A rectangular window (e.g., just using the input samples "as is") doesn't fatten the signal but has poor roll-off and first side lobe characteristics that tend to wipe out weaker signals in the vicinity of a stronger signal. Something like a Kaiser window is much better for allowing you to distinguish weaker signals in the vicinity of stronger ones. I would suggest looking at the Harris paper; he includes a table identifying key performance parameters of the signals.
Also, take a look at James Tsui's book "Digital Techniques for Wideband Receivers (2ed)." His chapter on DFTs has a graphical representation on DFTs that might help you visualize what is happening with standard rectangular windowing. Once you visualize that you can look at the frequency spectrum for a given window and visualize how that would impact the frequency spectrum of the windowed signal of interest by remembering that multiplication in the time domain equates to convolution in the frequency domain. This chapter includes some frequency domain plots of a few key window types showing how they compare in terms of the three items I mentioned above. This book is also a wealth of information on all sorts of real-world issues and their impacts on how you calculate key pieces of information.
As gregladd pointed out, the aggregate response of the time window (considering both duration and shape) will result in a frequency response with a modified sinx/x shape with a main lobe and sidelobes. A common definition of "resolution" is the 3-dB width of the main lobe. The idea behind that is that as the main lobes of two adjacent tones come closer together, it is still possible to "resolve" them to the point where the 3dB dip still exists between them.
Clearly that's a little bit arbitrary, but it is a fairly common definition for the case of resolving two tones. It's not a bad definition as it recognizes that the width of the main lobe of the frequency response plays heavily in being able to resolve features in the output of an FFT.
You can always greatly improve your resolution and noise bandwidth by increasing the window length, but this comes with a cost in computation complexity. Changing the window type allows you to make a trade-off between Highest Side Lobe and 6-dB BW without affecting the computation complexity. There are others Figures of Merit that are affected by the window type. I suggest you read the paper "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform" by Fredric J. Harris, freely available on the provided link, for a deep understanding of all this Figures of Merit.
My suggestion is: increase the window length as much as you can and select a window type with a highest side lobe level attenuation at least 6 dB greater than your input dynamic range.
I like Fred's response.
I have an additional thought to keep in mind.
If there are an integer number of cycles of the sine/s in the length of you data sample, then don't use a window. If you do a DFT (remember that for MatLab, the FFT function can be virtually any length) then all the energy of that sine wave will fall into one single bin with no side lobes.
If you want to discriminate two very close frequencies, then you really need an integer number of cycles of each of them to completely separate them.
The concept behind this time/frequency trade off is related to Heisenberg's uncertainty principle. You can know where the particle is at some instant, or you can know how fast it is moving but you can never know both at the same time.
Apologies for likely duplication, but the optimal window for frequency-resolution in stationary noise is the rectangular window. See the classic papers by Rife and Boorstyn for details.
Yes, when there are two closed spaced frequencies, what really makes the difference in being able to resolve them? I've seen that the resolution is defined by df=b(fs/N) but I've also read that the frequency leakage of the strongest signal affects the resolution of the weaker and the amplitudes are not considered in this formula. Also, it seems that using a rectangular window makes it more clear to see the peaks regardless of their spacing or amplitudes..I'm confused.
With a rectangular window the energy from the stronger signal does leak into the other bins in a "big way." The first side lobe from the energy spectrum of the stronger signal will only be 13 dB down from the peak, thus obscuring any weaker signal near that side lobe.
As to what is happening here, remember that we can equate multiplication in the time domain with convolution in the frequency domain. Let's say that the signal of interest is a CW signal, which shows up as a spectral line in a Fourier transform. Applying a rectangular window to this signal is the same as multiplying the original CW signal by a rectangular "pulse" whose length is the length of the window. The Fourier Transform of that pulse is represented by a sinc function. So, multiplying by the rectangular pulse in the time domain equates to convolving the spectral line in the frequency domain by a sinc function, which effectively makes the resulting spectrum look like a sinc function as per the sifting property. (I am using analog concepts here to make it easier to visualize.)
Effectively we have "smeared" the spectral line by applying a window. The power in the CW signal now has an infinite frequency extent. If I had two such signals in the original set the frequency spectra would be added together. If one of the signal was much stronger than the other its sinc function spectra would totally obscure the weaker signal.
Thank you all for your replies and explanations, everything is making more sense now. I've been reading Harris paper as greglad and jmarcelold suggested, and there's a very good example of this situation. He also talks about 'coherent summation' at the crossover points that will cause the peaks to appear as one and reinforces the idea that "is the 6dB bandwidth which defines the resolution of the windowed DFT".
So as a conclusion, am I right to say that, in order to be able to correctly resolve two equal strength signals, within a fixed window size, their spacing cannot be less that 6dB in bandwidth, or if it is, the crossover point must occur beyond 6dB from their peaks?