Output: another sequence of complex numbers such that:Intuitively, this means that we are braking up the complex signal into sinusoidal frequencies:and is the amplitude of each sine.
- : is kind of magic and ends up being a constant added to the signal because
- : sinusoidal that completes one cycle over the signal. The larger the , the larger the resolution of that sinusoidal. But it completes one cycle regardless.
- : sinusoidal that completes two cycles over the signal
- ...
- : sinusoidal that completes cycles over the signal
We use Zero-based numbering in our definitions because it just makes every formula simpler.
Motivation: similar to the Fourier transform:In particular, the discrete Fourier transform is used in signal processing after a analog-to-digital converter. Digital signal processing historically likely grew more and more over analog processing as digital processors got faster and faster as it gives more flexibility in algorithm design.
- compression: a sine would use N points in the time domain, but in the frequency domain just one, so we can throw the rest away. A sum of two sines, only two. So if your signal has periodicity, in general you can compress it with the transform
- noise removal: many systems add noise only at certain frequencies, which are hopefully different from the main frequencies of the actual signal. By doing the transform, we can remove those frequencies to attain a better signal-to-noise
Sample software implementations:
- numpy.fft, notably see the example: numpy/fft.py
DFT of with 25 points
. This is a simple example of a discrete Fourier transform for a real input signal. It illustrates how the DFT takes N complex numbers as input, and produces N complex numbers as output. It also illustrates how the discrete Fourier transform of a real signal is symmetric around the center point.See sections: "Example 1 - N even", "Example 2 - N odd" and "Representation in terms of sines and cosines" of www.statlect.com/matrix-algebra/discrete-Fourier-transform-of-a-real-signal
The transform still has complex numbers.
Summary:Therefore, we only need about half of to represent the signal, as the other half can be derived by conjugation.
- is real
"Representation in terms of sines and cosines" from www.statlect.com/matrix-algebra/discrete-Fourier-transform-of-a-real-signal then gives explicit formulas in terms of .
NumPy for example has "Real FFTs" for this: numpy.org/doc/1.24/reference/routines.fft.html#real-ffts
DFT of with 25 points
. Source at: numpy/fft_plot.py. This plot illustrates how the DFT of a real signal is symmetric around the middle point, and so only half of the transform points are needed to reconstruct the original signal. We also see how the phase of the sinusoids determines if their DFT components are real or imaginary.There are actually two possible definitions for the DFT:
- 1/N, given as "the default" in many sources:
- , known as the "normalized DFT" by some sources: www.dsprelated.com/freebooks/mdft/Normalized_DFT.html, definition which we adopt:
The is nicer mathematically as the inverse becomse more symmetric, and power is conserved between time and frequency domains.
An efficient algorithm to calculate the discrete Fourier transform.