hn.today

Notes on the discrete Fourier transform (DFT)

eli.thegreenplace.net45 points5 comments
Screenshot of Notes on the discrete Fourier transform (DFT)

The discrete Fourier transform (DFT) analyzes the frequencies represented in a finite sequence of N digital samples. It treats those samples as one period of a periodic signal and expresses them as coefficients of complex exponentials. Each DFT coefficient is a weighted sum of the samples, with the weights determined by one of N equally spaced frequency values. This also connects the DFT to the discrete-time Fourier transform: the DFT gives N samples of that continuous-frequency transform. A direct implementation computes each coefficient separately, while a matrix formulation shows that the transform uses powers of complex roots of unity. These vectors form an orthogonal basis for N-dimensional complex-valued sequences.

The inverse DFT reconstructs the samples exactly by applying the conjugate Fourier matrix and dividing by N; this follows both from the periodic-series formula and from the matrix’s orthogonality. A worked triangular-wave example illustrates the forward transform and exact reconstruction, apart from floating-point rounding. For practical computation, the fast Fourier transform exploits the Fourier matrix’s structure to reduce the work from O(N²) to O(N log N). The discussion also explains spectral leakage: when a finite sample block does not contain a whole number of cycles, repeating it creates edge discontinuities, spreading frequency contributions across bins. Window functions taper the edges and can reduce this effect, though the truncated samples can still be reconstructed perfectly.

Read on eli.thegreenplace.net5 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Science

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.