# Electronic – How to select frequency resolution and window size in FFT

dspfft

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.

#### Best Answer

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.