FFT Viewer: DFT Magnitude and Phase, Bin by Bin
Enter samples, choose a window and padding, and read the DFT as a plot and as a table of real part, imaginary part, magnitude and phase.
| k | Re X[k] | Im X[k] | |X[k]| | Phase (°) |
|---|---|---|---|---|
| 0 | 4 | 0 | 4 | 0 |
| 1 | 1 | -2.414 | 2.613 | -67.5 |
| 2 | 0 | 0 | 0 | 0 |
| 3 | 1 | -0.4142 | 1.082 | -22.5 |
| 4 | 0 | 0 | 0 | 0 |
| 5 | 1 | 0.4142 | 1.082 | 22.5 |
| 6 | 0 | 0 | 0 | 0 |
| 7 | 1 | 2.414 | 2.613 | 67.5 |
The formulas
The N-point DFT. The FFT computes the same numbers in about N log₂ N operations instead of N².
The Hann window: it tapers the ends to zero, which lowers leakage at the cost of a wider main lobe.
Worked example: four ones and four zeros
- x = [1, 1, 1, 1, 0, 0, 0, 0], N = 8.
- X[0] is the sum of the samples: 4.
- For the others, |X[k]| = |sin(πk/2) / sin(πk/8)|: |X[1]| = 1 / 0.3827 = 2.613, |X[2]| = 0, |X[3]| = 1 / 0.9239 = 1.082, |X[4]| = 0.
- Bins 5 to 7 mirror bins 3 to 1, since the input is real: X[N − k] is the complex conjugate of X[k].
- Zero-padding doesn't add information. It samples the same underlying spectrum more finely, so peaks are easier to locate.
- With N a power of 2 the tool uses a radix-2 FFT; otherwise it computes the DFT directly. The numbers are the same.