DSPRelated.com

Dirichlet Kernel

Category: Spectral

The Dirichlet kernel is a trigonometric function defined as the sum of N complex exponentials equally spaced in frequency, evaluating to sin(Nω/2) / sin(ω/2) in closed form. In spectral analysis, it describes the frequency-domain response of a rectangular window and appears directly in the DFT as the shape of each bin's response to a pure tone at an arbitrary frequency.

In practice

When a DFT is computed over N samples with a rectangular (no) window, each output bin does not respond only to its exact center frequency. Instead, its response to a sinusoid at frequency f is shaped by the Dirichlet kernel: maximum at the bin center, falling off to sidelobes that decay slowly (roughly 1/n envelope) and that alias periodically across the DFT spectrum. This is the root cause of spectral leakage in rectangular-windowed DFTs. Understanding the Dirichlet kernel makes the leakage pattern predictable rather than mysterious.

In practice, the Dirichlet kernel appears in the closed-form expression for DFT bin values when the input is a pure complex tone at a non-integer normalized frequency. The blog post "DFT Bin Value Formulas for Pure Complex Tones" derives exactly this: each bin's complex value equals the tone's amplitude scaled by the Dirichlet kernel evaluated at the offset between the tone's frequency and that bin's center frequency. This relationship is what "Three Bin Exact Frequency Formulas for a Pure Complex Tone in a DFT" and related interpolation work exploit to recover a tone's exact frequency and amplitude from neighboring bin values.

The sidelobe structure of the Dirichlet kernel is also the reason windowing functions (Hann, Blackman, Kaiser, etc.) are applied before the DFT. These windows trade main-lobe width for reduced sidelobe levels, effectively replacing the Dirichlet kernel's slow sidelobe decay with something more favorable for detecting signals near stronger ones. The Dirichlet kernel therefore serves as a baseline against which window performance is measured.

For embedded DSP work on resource-constrained targets, the kernel rarely needs to be evaluated explicitly at runtime. Its importance is mostly analytical: it explains why bin interpolation formulas work, why leakage occurs, and how much amplitude and frequency error to expect when a tone falls between bins. Fixed-point DFT implementations on MCUs such as those in the STM32 or dsPIC families face the same leakage effects; the underlying mathematics is architecture-independent.

Discussed on DSPRelated

Frequently asked

What is the closed-form expression for the Dirichlet kernel as it appears in the DFT?
For an N-point DFT, the kernel evaluated at normalized radian frequency ω is D_N(ω) = sin(Nω/2) / sin(ω/2). At ω = 0 the value is N by L'Hopital's rule. In DFT terms, ω = 2π(f - k)/N where f is the tone's normalized bin index and k is the bin being evaluated, so the kernel measures how much a tone at f leaks into bin k.
Why do the Dirichlet kernel's sidelobes cause problems in practice?
The sidelobes decay only as 1/sin(ω/2), which is approximately 1/ω away from the main lobe. This means a strong tone can mask a weaker tone even many bins away. For example, a tone 13 dB stronger than a neighboring tone can completely obscure it in a rectangular-windowed DFT. Windowing reduces sidelobe levels at the cost of a wider main lobe.
How is the Dirichlet kernel used in bin interpolation frequency estimators?
Because each bin's complex DFT value equals the tone amplitude times the Dirichlet kernel evaluated at the bin-to-tone frequency offset, ratios of adjacent bin values cancel the amplitude and leave expressions that depend only on the fractional offset. This is the basis of the formulas derived in 'Three Bin Exact Frequency Formulas for a Pure Complex Tone in a DFT' and 'DFT Bin Value Formulas for Pure Complex Tones'. Solving for the offset gives the tone's exact frequency within the DFT resolution limit, assuming no noise and a single tone.
Is the Dirichlet kernel the same as the DFT's frequency response to a rectangular window?
Yes, they are the same object viewed from two angles. The rectangular window in the time domain is a boxcar of N ones. Its DTFT is the Dirichlet kernel. When that windowed signal is fed into the DFT, each bin's response to an off-bin tone is shaped by the Dirichlet kernel. So 'Dirichlet kernel', 'rectangular window spectrum', and 'DFT bin frequency response' all refer to the same function in this context.
Does the Dirichlet kernel apply only to the DFT, or is it relevant to other transforms?
The Dirichlet kernel arises wherever a finite sum of complex exponentials is evaluated, so it appears in the analysis of any transform or filter bank that operates on finite-length segments. It is central to Fourier series convergence theory and shows up in the study of FIR filter design. In the embedded DSP context, however, it is most commonly encountered when analyzing DFT leakage and bin interpolation accuracy.

Differentiators vs similar concepts

The Dirichlet kernel is sometimes confused with the Fejér kernel, which is the arithmetic mean of the first N Dirichlet kernels and corresponds to a triangular (Bartlett) window rather than a rectangular one. The Fejér kernel has no negative sidelobes and converges more uniformly in Fourier series contexts, but it has a wider main lobe. The two kernels are related but serve different analytical roles: the Dirichlet kernel describes rectangular-window DFT leakage directly, while the Fejér kernel appears in Cesàro summation and triangular-windowed analysis.