9

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.

PeterJ
  • 17,131
  • 37
  • 56
  • 91
nitin
  • 101
  • 1
  • 1
  • 4
  • 2
    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)? – Vasiliy Aug 21 '13 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. – nitin Aug 21 '13 at 11:52
  • 4
    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. – Scott Seidman Aug 21 '13 at 12:13
  • @ScottSeidman, you read my mind. – Vasiliy Aug 21 '13 at 12:58
  • Since you are dealing with something that you can probably at least *pretend* is audio data, fire up a tool like `audacity` (see the import raw data menu) and try the different options and see which results you like best, then make your own implementation. Also note that while it's easy to think of FFT's being evaluated sequentially, you can actually overlap them to produce a result as often as every sample, rather only every [FFTSIZE] samples. Of course multiple simultaneous evaluations increases the computational load. – Chris Stratton Aug 21 '13 at 13:15
  • This tutorial may help. It does not cover overlapping FFT windows: http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html – Bjorn Roche Aug 21 '13 at 13:37
  • @ScottSeidman, the question is not application specific, it is general. The question is already answerable. – travisbartley Aug 23 '13 at 07:23
  • @trav1s I can't see it. There is nothing to indicate what frequency resolution needed in the fft. If he's trying to make a picture pretty for a rough speaker test, he needs a few hundred points. If he needs tenth of Hertz resolution, he might need 100k – Scott Seidman Aug 23 '13 at 10:35
  • @ScottSeidman, the question can be answered by *teaching the underlying principles so the OP can choose the size himself.* By asking for more details you're missing the point. It doesn't help others if you solve problems on a case by case basis. It helps others when you teach them how to solve problems. – travisbartley Aug 23 '13 at 11:03
  • 1
    @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. – Scott Seidman Aug 23 '13 at 12:14

2 Answers2

4

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.

krb686
  • 1,215
  • 13
  • 23
deadude
  • 687
  • 3
  • 11
  • 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. – Chris Stratton Oct 08 '14 at 18:37
0

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.

Yasir Ahmed
  • 179
  • 8
  • 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 –  Jan 26 '18 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! – Yasir Ahmed Jan 26 '18 at 17:08