Compute DFT and FFT of discrete signals. Visualize time and frequency domains with interactive graphs. Essential signal processing tool for engineers and students.
DFT Formula: For a sequence x[n] of length N, the DFT X[k] is:
X[k] = Σn=0N-1 x[n] · e-j2πkn/N
where k = 0, 1, ..., N-1, and j = √(-1) is the imaginary unit
Single frequency sinusoid
Periodic on/off signal
Sum of two sine waves
Periodic impulses
Frequency increases with time
Sine wave with added noise
The Discrete Fourier Transform (DFT) converts a finite sequence of equally-spaced samples of a function into a same-length sequence of equally-spaced samples of the discrete-time Fourier transform (DTFT). It's a fundamental tool in digital signal processing.
DFT Definition:
For a sequence x[n] of length N, the DFT X[k] is defined as:
X[k] = Σn=0N-1 x[n] · e-j2πkn/N
where:
Inverse DFT (IDFT):
x[n] = (1/N) · Σk=0N-1 X[k] · ej2πkn/N
The IDFT reconstructs the original time-domain signal from its frequency components.
| Property | Time Domain | Frequency Domain |
|---|---|---|
| Linearity | a·x[n] + b·y[n] | a·X[k] + b·Y[k] |
| Time Shift | x[n - m] | X[k] · e-j2πkm/N |
| Frequency Shift | x[n] · ej2πmn/N | X[k - m] |
| Circular Convolution | x[n] ⊛ y[n] | X[k] · Y[k] |
| Parseval's Theorem | Σ |x[n]|² | (1/N) Σ |X[k]|² |
| Symmetry (Real x[n]) | x[n] real | X[k] = X*[N-k] (conjugate symmetric) |
DFT (Discrete Fourier Transform): Direct implementation of the DFT formula. Computational complexity is O(N²), which makes it inefficient for large N.
FFT (Fast Fourier Transform): An algorithm that efficiently computes the DFT. Most common implementation is the Cooley-Tukey algorithm with complexity O(N log N). Requires N to be a power of 2 for optimal performance.
Comparison: FFT produces identical results to DFT but much faster. For N=1024 samples, DFT requires ~1 million operations while FFT requires only ~10,000 operations.
Frequency Resolution: Δf = Fs / N
where Fs is the sampling rate and N is the number of samples.
The frequency at bin k is: fk = k · Δf for k = 0 to N/2, and fk = (k - N) · Δf for k = N/2+1 to N-1.
1, 0, -1, 0
Sine wave (4 samples)
1, 1, 1, 1, 0, 0, 0, 0
Rectangular pulse
1, 2, 3, 4, 4, 3, 2, 1
Triangular window
1, -1, 1, -1
Alternating sequence
1, 0, 0, 0, 0, 0, 0, 0
Unit impulse