Electronic – Calculating FFT for only part of full frequency range

fftoversamplingsampling

Earlier I asked a question here about performing FFT at lower frequencies but still at high sample frequencies. I was under the impression that the FFT was inherently calculated at every frequency 0->(Sampling Frequency)/2 distributed in bins of width Fs/(2*N). But, looking at some of the answers I received, it appears that it is possible that Fs is only useful in determining the maximum frequency, which is Fs/2, but that it is entirely possible to, say, sample at 640 Hz but to only sample frequencies 0-64 Hz.

Yet, from what I've read so far on FFT implementations, it appears that the FFT in the examples I'm seeing, is being performed on the entire range 0->Fs/2, so I'm not entirely sure how to go about performing the FFT on only a portion of the maximum frequency.

Now, just to pre-empt this, I realize that somewhere along the line there is a high chance of some sort of misunderstanding on my part. I'm not entirely sure what I'm missing, but that's why I laid out my current understanding here and maybe somebody can properly explain why I'm perceiving that the FFT is only being performed on a part of the range, which I have the suspicion, due to the contradiction outlined above, is just an incorrect interpretation by me. Or maybe oversampling requires some sort of different logic that I was unaware of. In either case, I'm left a little confused so any help is appreciated.

Best Answer

I was under the impression that the FFT was inherently calculated at every frequency 0->(Sampling Frequency)/2 distributed in bins of width Fs/(2*N).

This is roughly correct. A discrete fourier transform (DFT) produces output for frequencies between \$-F_s/2\$ and \$F_s/2\$. If the input data is real-valued (rather than complex) the negative-frequency spectrum will just be the complex conjugate of the positive-frequency spectrum, so some time can be saved by not calculating the negative frequency bin values.

The spacing of the bins is \$F_s/N\$, not \$F_s/(2N)\$.

I'm not entirely sure how to go about performing the FFT on only a portion of the maximum frequency.

To calculate a small number of bins, there is a method called the Goertzel algorithm for calculating one bin at a time.

As a rule of thumb, it's typically more efficient to calculate \$M\$ bins of a DFT by the Goertzel algorithm when

$$M \le \frac{5 N_2}{6 N} \log_2(N_2)$$

where \$N_2\$ is the next power of two greater than \$N\$.