Assuming a signal is sampled adequately, what is the minimum size of an FFT window that would allow detecting a specific frequency? Is it necessary to have samples for at least one complete period at that frequency?
-
$\begingroup$ note that the window length of the FFT and the sampling rate are two different things. Do you mean "at least two samples per window"? $\endgroup$– endolithJul 11, 2012 at 19:55
-
$\begingroup$ @endolith. What should be the minimum window length of FFT to detect a tone frequency? $\endgroup$– hariJul 12, 2012 at 5:43
-
2$\begingroup$ Is that what your question is asking, or is that a separate question? $\endgroup$– endolithJul 12, 2012 at 13:51
-
$\begingroup$ @endolith. Yes I am asking same. May be my question is not so clear. Sorry. $\endgroup$– hariJul 13, 2012 at 10:10
5 Answers
Please define "specific frequency".
Any signal with no frequency components above the Nyquist limit can be exactly recorded and re-constructed.
However, the number of samples determines the frequency resolution.
if you mean "i want to be able to tell the difference between silence and a 1000hz signal, then you would need 4 samples taken less 1/2000th of a second apart - using that you can solve for the 0 frequency signal (dc offset), and the strength of the other frequency.
if you mean "i want to be able to separate a 900hz signal from a 1000hz", then you need to resolve 11 frequency windows, ie, you'll need 22 samples taken at at least 2000 samples per second; then you'll have measured "frequencies around 0, 100,200,300...900,1000 hz", and you can answer "do i have a 900hz signal".
if you want to measure to the nearest hz the frequency of a N hz signal, then you would need to take at least 2N samples, taken at atleast 2N samples/second.
-
$\begingroup$ What would be the case for an oversampled signal. $\endgroup$– VinodAug 1, 2014 at 5:28
-
$\begingroup$ In the presence of imperfect sampling (bit precision, time jitter) the oversampling can compensate. Also, all systems have some white noise in them, so the oversampling minimises aliasing the high frequency white noise into the signal your trying to measure. $\endgroup$ Aug 2, 2014 at 23:44
-
$\begingroup$ With extreme oversampling you can get away with only using a 1 bit ADC ( en.m.wikipedia.org/wiki/1-bit_DAC) $\endgroup$ Aug 2, 2014 at 23:47
You can conduct Fourier transform at any sampling rate. It's just that you won't be able to restore the original signal if your sampling rate is not greater than Nyquist frequency. There will be alias.
-
$\begingroup$ I agree with your comment. But suppose I have a tone of 8KHz, and do sampling at 16k samples/sec. For a single period of tone, I will have 2 sample information in discrete domain. May I predict the frequency by these only 2 samples. I should have more number of samples to detect the frequency content in the signal. Hope you understand the point. $\endgroup$– hariJul 11, 2012 at 5:16
-
2$\begingroup$ @hari: Note that sample rate needs to be greater than 2x max frequency, so you can't sample an 8 kHz signal with a sample rate of 16 kHz. $\endgroup$– Paul RJul 11, 2012 at 11:19
-
$\begingroup$ Yes.. I agree Paul. Now Suppose I do sampling at 4x times. I am here just looking for minimum required number of samples to do fourier transform to get minimum main lobe width. $\endgroup$– hariJul 11, 2012 at 12:12
Andrew Hill's answer does not look correct to me: to increase frequency resolution you need to increase the sample time (not the sampling rate, which is related to the maximum recoverable frequency in the signal).
Tendolkar's answer in Quora is correct, and you can verify it with a couple of simple cases in your favorite tool/language.
The Fourier transform of a sine signal is a Dirac impulse in frequency domain. But for the sampled sine signal you won't get the expected Dirac impulse in most cases (1) - even if you don't violate the sampling theorem. This is because your sampled time sequence must be finite in length, which means that the original sine signal is implicitly multiplicated with a rectangular impulse in time domain. This corresponds to a convolution with a $sin(x)/x$ function in frequency domain and is referred to as windowing effect.
This observation is reflected in the constraint to the sampling theorem: the original signal can be reconstructed perfectly from its sampled version if the sampling frequency is higher than double the highest frequency in the band-limited analog signal and if an inifinite number of samples is drawn from the analog signal.
(1) Let $x(n) = sin(\alpha n)$ be the sampled sine signal. The discrete Fourier transform will be a Dirac impulse if $\alpha = k \Delta \omega$, where $\Delta \omega = \frac{2\pi}{N}$ and $N$ is the number of samples. This is because in this case it happens that you sample the $sin(x)/x$ shaped frequency spectrum at its zero crossings (except for the fundamental frequency). If you use the discrete time Fourier transform, however, you will always see the $sin(x)/x$ spectrum.
The number of samples required depends on the signal-to-noise ratio, all the way down to just 3 or 4 non-aliased samples for a single pure sinusoid in zero noise, up to many periods if the sinusoid is way below a noise floor of white noise (with either more than 2 samples per period, or wide flat empty spots in the spectrum at all possible alias frequencies.)
-
$\begingroup$ Suppose if we have tone with SNR very very high lets take 140dB. May we have any mathematical formulation to say about minimum number of samples required to detect the tone frequency. $\endgroup$– hariJul 12, 2012 at 5:46
-
$\begingroup$ With very high SNR and a pure tone you'd be better off using a simple slope detector scheme to determine frequency. The "hash" generated by the edges of the FFT window (even if a windowing function is used) will add considerable noise. I'd guess (making a SWAG here) that you'd need at least 8 full cycles (>16 samples) to be able to detect frequency via FFT with moderately good reliability. (And then recall that, with only 8 cycles, your error in determining frequency is at least 12%, even if you don't have FFT windowing problems.) $\endgroup$ Jul 13, 2012 at 19:34
-
$\begingroup$ @hari : Any formula will depend not only on the S/N ratio, but the frequency and the phase of the pure signal with respect to the capture window, and the exact type of noise, if non-zero. Here's a 4 point formula for the zero noise case: claysturner.com/dsp/4pointfrequency.pdf $\endgroup$– hotpaw2Jul 13, 2012 at 20:11