# Can I test any frequency with DFT?

Please let me the subject question, for I see in DFT equations testing frequencies sub-multiples of sampling frequency. Regards.

The relation of a DFT to an actual Fourier transform is tenuous.

To arrive at a DFT starting with a continuous signal, the following steps significantly changing the signal are taken:

a) low-pass filtering is applied in the analog domain to remove any frequency content outside of the frequency range to be examined. If the signal is essentially a lowpass signal already, this should not cause significant changes. This step limits the information content to something representable by sampling. In the frequency domain, it windows a finite section of signals.

b) the signal is sampled at equidistant sampling points, discarding everything else. This fundamentally changes the character of the signal even if not the information content. In the frequency domain, this replicates the windowed section of step a) across the whole spectrum. The replicas are placed at multiples of the sampling frequency.

c) a finite span of samples is taken and everything else thrown away. In the frequency domain, this corresponds with smoothing/lowpass filtering with the limiting "frequency" being the time length of the finite span taken (frequencies and times are inverses and duals).

d) the finite span of samples is replicated across all the time domain. In the frequency domain, this corresponds with sampling the Fourier transform at multiples of the inverse of the finite span length (which is also the replication length) and discarding all intermediate values.

After that process, we have the DFT. Most of these steps can cause serious artifacts and bleedovers in time/frequency domain if the analyzed material does not just consist of sinoids with a period that wholly divides the analysis length. If the assumptions are met, step d) will only discard values that are zero anyway. If not, the combination of the last two steps significantly changes the character of the analysis.

Now FFT is an efficient implementation of a DFT and that is a great building block for a lot of analysis tools as long as you don't confuse it with a finished tool. To create actual analysis tools, one works with windowing, warping, smoothing, binning, and statistics in order to get a reasonable tradeoff between the various artifacts introduced by the operations performed in time and frequency domain by DFT itself as well as the additional tools one groups around it. A naked unadorned DFT tends to have rather bad tradeoffs regarding either changing signal characteristics or bad matches of signal frequency to analysis period.

• @ user27390: Please accept my many thanks for your helpful answer. I'm interested in audio frequencies (harmonics) up to 5 kHz. Analog Digital Converters have electronic (analog) selectable filter, before sampling, with cut off frequency about Nyquist's. I expect to not select any electronic filter and use 48 ksample/sec sample rate. Then only harmonics in the range 43 kHz - 48 kHz alias in the interesting range. My knowledge so far is that audio signal does not contain so high harmonics. Is that okay? Regards. – George Theodosiou Mar 24 '17 at 17:04
• @GeorgeTheodosiou. To make a good design, you should always have an analog filter before an ADC. Audio signals exists above 48 KHz. Your ears cannot hear them but a microphone could. Even electromagnetic noise could be injected in your circuit, then your ADC would read false frequencies. The analog filter should be designed such that it removes every frequencies above the Nyquist frequency. For a 48KS/sec ADC, Nyquist frequency is 24 KHz – Pier-Yves Lessard Apr 20 '17 at 12:06
• @ Mr. Pier-Yves Lessard: Please accept my many thanks for you commented my question, and for information that "Audio signals exists above 48 KHz". Also please let me ask: do you mean that? or you mean "audio signals exist just above 24 kHz"? . I'm interested for audio frequencies up to 5 kHz and expect to use no one analog filter, but a low pass digital FIR filter of 999 taps and cut-off zone 5 kHz - 6 kHz. Then is sample rate 96 ksample/sec okay? Regards. – George Theodosiou Apr 22 '17 at 8:32
• @GeorgeTheodosiou Yes I meant that. Above 24Khz or 48KHz, the point is still the same. To have a reliable system, you should always add an analog filter before the ADC input to remove frequencies above Nyquist. Rising the sampling rate won't be enough. If you use a 96Ksample/s ADC, you will need an analog filter to remove what's above 48KHz. Basically, the analog filter remove what cannot be removed by a digital filter (because of Nyquist limitation). What you intend to do will be working, but will not be high quality system as you may have aliasing distortion. – Pier-Yves Lessard Jun 18 '17 at 20:31
• @ Pier-Yves Lessard: Please accept my many thanks for your comment. I expect to cut out magnitude squared lower than a certain limit, so that very weak frequencies be cut out. By this way noise also be cut out. After that by "max" statement catch first local maximum of magnitude squared. As you understand I am not interested for the signal after DFT, but only for the first local maximum of magnitude squared. See my answer to my question dsp.stackexchange.com/questions/38629/… program in C++ catching first harmonic. – George Theodosiou Jun 20 '17 at 8:17

Yes, what you've observed is correct:

The $N$-point DFT only "compares" a signal to the set of complex oscillations $e^{j2\pi f n}$ for frequencies $f$ that fit an integer number of times into the DFT length $N$.

Any other frequency will not be mapped "sharply" to a single DFT bin, but will have some energy in the surrounding bins and spectral repetitions.

We use windows on the input signal of a DFT to shape that "bleeding" a bit.

It is very common to increase the "resolution" by having a greater $N$. To do that, you simply take $K<N$ samples of your input, and attach $N-K$ zeros, so that you end up with a vector of $N$ samples. That way, you can have a finer "grid" of frequencies.

• @ Mr. Marcus Müller, please let me express my gratitude for you answered my question. Although I understand only first sentence (Yes, what you've observed is correct) this is what I observe. Many thanks. Regards. – George Theodosiou Dec 20 '16 at 15:44
• @Marcus Müller Although I know you understand this we should mention for others since your last sentence sounds otherwise that adding zeros does NOT increase the frequency resolution but merely interpolates the samples that exist. The frequency resolution in Hz at best without any windowing is 1/T where T is the length of the signal in time given in seconds. We can add more zeros after this which will increase the number of points in the FFT but does not increase resolution beyond interpolating what we started with. (Again, this is a comment to help others understand) – Dan Boschen Mar 20 '17 at 15:52