Discrete-Time Signals and the Discrete Fourier Transform (DFT)
When we sample a continuous-time signal at a sampling rate (in Hz), or when we work with inherently discrete data (such as digital audio or images), the resulting signal is represented as a sequence:
The Discrete Fourier Transform (DFT)
The DFT converts a discrete-time sequence into its frequency-domain representation , which shows how much of each frequency component is present in the signal:
- is the bin index corresponding to a discrete frequency.
- is generally complex-valued, representing both amplitude and phase of the frequency component.
Inverse DFT
The inverse DFT (IDFT) reconstructs the time-domain sequence from its frequency-domain representation:
Notice the sign of the exponent is reversed compared to the DFT, and we divide by to normalize.
This repository follows the engineering / FFT convention, where the forward FFT has a negative exponent and the inverse FFT has a positive exponent. In other paradigms, it is conventional for the forward FFT to have a positive exponent and the inverse FFT to have a negative exponent.
The sign does not matter as long as the sum of the forward FFT's exponent and the inverse FFT's exponent
Frequency Bins
Each DFT output (X[k]) corresponds to a discrete frequency:
- Frequencies above correspond to negative frequencies (aliases):
- For real-valued signals, the DFT is conjugate symmetric:
This means we only need to examine the first half of the spectrum for amplitude information.
- The DFT assumes periodicity: it treats the finite sequence as one period of an infinitely repeating discrete signal. This is why windowing and zero-padding are important — they reduce artifacts caused by discontinuities at the boundaries.
- The frequency resolution depends on the number of samples and sampling rate: . This is the spacing between adjacent frequency bins.
- The DFT and IDFT differ in exponential sign (rotation direction) and a normalization factor, which ensures perfect reconstruction.