How to select frequency resolution and window size in FFT?

I am doing spectrum analysis of a time varying signal with frequency changing from 200Hz to 10kHz. I am using the FFT for analyzing the frequency component in the signal. My questions are:

1. How to decide on the frequency resolution and window width for the signal?
2. Which type of window function is suitable for the time varying signal?
3. What should be optimum size for FFT?

The sampling rate of the signal is 44.1kHz.

• What is the frequency change pattern? Does the signal abruptly hop between different frequencies, or the frequency change is continuous? If the signal hops, for what period of time can you assume the signal will remain at the same frequency? If the frequency change is continuous, what pattern does this change have (linear, gaussian, other)? Aug 21, 2013 at 11:46
• It does not hop it is continues varying signal similar to the Chirp signal. the amplitude for each frequency may change randomly. Aug 21, 2013 at 11:52
• You say you're taking the FFT to analyze the frequency component. This is an intermediate step, and to answer your question accurately, we need to know what you're trying to achieve. What do you intend to do with that information? Why do you need to know the frequency component? How often do you need to update this information? Without telling us this stuff, you're the only one who can know what the resolution needs to be. In fact, if you only need to know the answer at one or two frequencies, FFT may not even be the best way to go. Aug 21, 2013 at 12:13
• @ScottSeidman, you read my mind. Aug 21, 2013 at 12:58
• @trav1s, we all teach differently. If a student of mine came to me with this question asked in this way, I'd try to give him the same take home message that I was getting at with my detailed comment above-"An engineer should understand why he or she is doing something before embarking on it". There are a thousands of resources where one can find the equations describing frequency resolution as a function of N, and it felt like the questioner had them available, but that message isn't attached to them! Hopefully, the prodding made the asker realize he was holding the answer already. Aug 23, 2013 at 12:14

2 Answers

Since you are working with a fixed sample rate, your FFT length (which will require your window to be at the same width) will increase your frequency resolution. The benefit of having a finer frequency resolution is twofold: the apparent one is that you get a finer freqeuecy resolution, so that you might be able to distinguish two signals that are very close in frequency. The second one is that, with a higher frequency resolution, your FFT noise floor will be lower. The noise in your system has a fixed power, unrelated to the number of points of your FFT, and that power is distributed evenly (if we're talking white noise) to all your frequency components. Thus, having more frequency components mean that individual noise contribution of your frequency bins will be lowered, while the total integrated noise stays the same, which results in a lower noise floor. This will allow you to distinguish a higher dynamic range.

However, there are drawbacks to using a longer FFT. First one is that you'll need more processing power. The FFT is a O(NlogN) algorithm, where N is the number of points. While it may not be as dramatic as the naive DFT, the increase in N will start to bleed your processor, especially if you're working in the confines of an embedded system. Secondly, when you increase N, you're gaining frequency resolution while you're losing time resolution. With a bigger N, you need to take more samples to arrive at your frequency domain result, which means that you need to take samples for a longer time. You will be able to detect a higher dynamic range and finer frequency resolution, but if you're looking for spurs, you'll have a less clear idea about WHEN that spur occurred exactly.

The type of window you should use is a whole other subject, which I'm not that informed to give you an answer to WHICH one is better. However, different windows have different output characteristics, of which most(if not all) are reversible post processing the FFT result. Some windows may make your frequency components bleed to side bins (if I'm not mistaken, the Hanning window makes your components appear on three bins.), others may give you a better frequency accuracy while introducing some gain error to your components. This is completely dependent to the nature of result you're trying to achieve, so I'd do some research (or some simulations) to arrive at which one is the best for your specific application.

• Note that while it may be intuitive to run FFT evaluations on sequential blocks, it's also possible to run them on overlapping blocks of input data, ie, start a 1024-point FFT every 256 samples- giving somewhat better time resolution, though of course at the cost of yet more computation. Oct 8, 2014 at 18:37

So first things first, the sampling frequency must be at least twice the maximum frequency of the signal which it is (44.1kHz > 2x10kHz). Next if the length of the window in time domain is T the frequency resolution with FFT is exactly 1/T. Resolution in the frequency domain using the FFT has nothing to do with the sampling frequency in the time domain. But as pointed out in earlier answer the time domain window cannot be too large because then you would lose information about the spurious signals that pop up only momentarily. So there has to be a compromise between frequency resolution and detecting spurious signals. Lastly FFT is not the only algorithm to take a signal from time domain to frequency domain. If you are looking for high resolution in the frequency domain with limited number of samples in the time domain you can use high resolution spectral estimation techniques such as MUSIC and ESPIRIT. These are also used for direction of arrival (DOA) estimation which is quite similar to spectral estimation problem.

• um no... re-read nyquist. If you want to reliably reconstruct a frequency you would need 5-10x. Likewise a wider window permits reconstruction of the lowest frequency of interest go to sub harmonics. A spurious signal will not reliably be seen in an FFT anyway as a dirac pulse may have a high frequency content Its duty is "random" only a reliable/periodic component will be shown with significant amplitude
– user16222
Jan 26, 2018 at 15:05
• the frequency range of the signal of interest is from 200Hz to 10kHz...so the sampling frequency is at least 4.41 times the signal frequency...if we look at the lower end of the spectrum the sampling frequency is 220.5 times...we might need to know how the frequency is distributed statistically...anyway I think the sampling frequency is not a problem here! Jan 26, 2018 at 17:08