Gibbs phenomenon — overshoot at Fourier discontinuities

Fourier & Truncation (same on every page in this path)

1. Fourier series → 2. Gibbs phenomenon (you are here) → 3. FFT leakage → 4. Window figures of merit

Tools: Gibbs phenomenon demo · FFT window demo · FFT resolution

In one sentence: Near a jump discontinuity, the truncated Fourier sum overshoots by a fixed fraction of the jump — about Si(π)/π − ½ ≈ 8.95% — and that percentage does not go to zero as you keep more harmonics; only the width of the ringing shrinks.

Interactive lab

Open the Gibbs phenomenon demo: sweep harmonic count, compare square vs continuous triangle, try Lanczos σ-factors, and flip to the FIR dual (truncated sinc → ripples in H(f)). Shareable URL state is built in.

What you will learn

  • The precise statement of Gibbs’ overshoot for a unit jump, including the sine-integral constant
  • Why pointwise convergence fails at discontinuities while L² convergence still holds
  • The Dirichlet-kernel / convolution picture that makes the 9% inevitable for rectangular truncation
  • The dual FIR story: truncating an ideal brick-wall impulse response rings in frequency
  • What actually reduces the ripple (Fejér means, σ-approximation, windows) and what only narrows it (larger N)

Historical note (so the name makes sense)

Henry Wilbraham published the overshoot calculation in 1848. Half a century later, A. A. Michelson’s harmonic analyzer produced “strange” wiggles near square-wave edges; J. W. Gibbs explained them in letters to Nature (1898–1899). The community kept Gibbs’ name. The phenomenon is not a bug in someone’s plot — it is a theorem about rectangularly truncated trigonometric expansions of discontinuous functions.

Prototype problem: the square wave

Take the 2π-periodic square wave

$latex \displaystyle f(t)=\begin{cases}+1,&0<t<\pi,\\-1,&\pi<t<2\pi,\end{cases}$

with the average value 0 at the jumps. Its Fourier series contains only odd sine harmonics:

$latex \displaystyle f(t)=\frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\sin\!\big((2k+1)\,t\big)}{2k+1}.$

The N-term partial sum (first N odd harmonics) is

$latex \displaystyle S_N(t)=\frac{4}{\pi}\sum_{k=0}^{N-1}\frac{\sin\!\big((2k+1)\,t\big)}{2k+1}.$

Away from the jumps, $latex S_N(t)\to f(t)$ as $latex N\to\infty$. At a jump of height $latex J$, the series converges to the midpoint of the left and right limits — here 0. In any fixed neighborhood that includes the jump, the graphs of $latex S_N$ keep a characteristic first lobe whose height, relative to the jump, refuses to shrink.

Ringing artifact (Gibbs phenomenon) on a square wave when the number of frequency terms is truncated
Figure 1: Truncated Fourier sum of a square wave — classic Gibbs ringing at the edges.

The overshoot constant (why “about 9%”)

Shift coordinates so a unit jump sits at the origin. The partial-sum overshoot, in the limit of large N, is governed by the sine integral

$latex \displaystyle \mathrm{Si}(x)=\int_0^x\frac{\sin u}{u}\,du.$

For a jump of height 1, the first maximum of the limiting scaled partial sum lies at height

$latex \displaystyle \frac{\mathrm{Si}(\pi)}{\pi}\approx 0.58949,$

so the overshoot above the right-hand limit (which is ½ for a 0→1 jump centered at the midpoint convention) is

$latex \displaystyle \frac{\mathrm{Si}(\pi)}{\pi}-\frac12\approx 0.08949\quad(8.949\%).$

For our ±1 square wave the jump height is $latex J=2$, so the absolute overshoot approaches $latex 0.08949\cdot J\approx 0.179$. The relative figure — overshoot divided by jump — is universal for rectangular spectral truncation of an isolated jump: about nine percent.

What does grow with N? Not that percentage. The horizontal scale of the first lobe contracts like $latex \pi/N$ (more precisely, like the reciprocal of the highest retained frequency). The ripples pack against the discontinuity; their relative height asymptotes to the constant above.

Confirm it interactively: zoom view, N = 40, no taper. Then raise N further — the peak percentage barely moves.

Dirichlet kernel: the convolution view

Truncating a Fourier series to harmonics $latex |k|\le M$ is exactly convolution against the Dirichlet kernel

$latex \displaystyle D_M(t)=\sum_{k=-M}^{M}e^{ikt}=\frac{\sin\!\big((M+\tfrac12)t\big)}{\sin(t/2)}.$

Thus

$latex \displaystyle S_M(t)=\frac{1}{2\pi}(f*D_M)(t).$

Near a jump, $latex f$ looks locally like a Heaviside step. The convolution of a step with $latex D_M$ is an incomplete sine integral — and the first sidelobe of that integral is precisely the Gibbs overshoot. Rectangular windows in frequency are sinc-like kernels in time; sidelobes of that kernel are not optional.

This is also why a continuous triangle wave (continuous function, piecewise-smooth derivative) behaves differently: coefficient decay improves from $latex 1/k$ to $latex 1/k^2$, the Dirichlet lobes have less “step energy” to integrate against, and the overshoot → 0 as $latex N\to\infty$. The demo’s triangle mode makes that contrast visceral.

Discontinuities need infinite bandwidth

Fourier analysis trades localization in time for localization in frequency. An ideal jump is perfectly sharp in time and therefore demands a $latex 1/f$ harmonic tail — formally infinite bandwidth. Any instrument, ADC, or finite computer representation cuts that tail. Cutting it is multiplication by a rectangle in frequency, hence convolution with a sinc-like kernel in time: ringing.

Spectra of sine, square wave, and impulse
Figure 2: Smooth tones are compact in frequency; jumps and impulses are not.

Practical sources of the same artifact:

  • Band-limited measurement of edges — scopes and receivers with finite analog bandwidth
  • Hard spectral edits — zeroing FFT bins without a taper (related to spectral leakage)
  • Idealized “brick wall” filters realized with short impulse responses (next section)

FIR dual: Gibbs in the frequency domain

Swap the axes. An ideal low-pass frequency response

$latex \displaystyle H_{\mathrm{ideal}}(e^{j\omega})=\begin{cases}1,&|\omega|\le\omega_c,\\0,&\omega_c<|\omega|\le\pi\end{cases}$

has impulse response a discrete-time sinc of infinite support. The simplest FIR design — impulse-response truncation — keeps $latex |n|\le L$ and shifts to causality. Truncation in time is convolution of $latex H_{\mathrm{ideal}}$ with a Dirichlet-like kernel in frequency: passband and stopband ripples appear. That is Gibbs phenomenon again, now drawn on the frequency axis.

Lengthening the filter (larger span) narrows the transition band; rectangular truncation still leaves ~9%-class ripples relative to the discontinuity in $latex H$. Windowing the sinc (Hann, Hamming, Kaiser, …) is σ-approximation in disguise: you trade transition width and main-lobe width for sidelobe / ripple height. That is the entire pedagogical bridge to the window-functions demo and the figures-of-merit article.

Truncated sinc with short span showing strong Gibbs ripple in frequency
Figure 3: Short truncated sinc (Nsym = 5) — strong frequency-domain Gibbs ripple.
Truncated sinc with medium span
Figure 4: Longer span (Nsym = 15) — narrower transition, ripples remain.
Truncated sinc with long span
Figure 5: Still longer (Nsym = 35) — transition tightens; rectangular truncation still rings.

Explore the same dual live: FIR view, span = 8, then increase the span slider.

Mitigation: what actually helps

  • More harmonics alone — localizes ringing; does not kill relative overshoot for a true jump under rectangular truncation.
  • Fejér means (Cesàro averages of partial sums) — replace Dirichlet by Fejér’s non-negative kernel; overshoot disappears, edges blur.
  • Lanczos σ-factors — multiply the k-th coefficient by $latex \mathrm{sinc}(k/N)$; a classical compromise, available in the demo’s taper menu.
  • Windowed FIR / tapered spectral edits — same idea in filter design and in FFT processing; pick the window using sidelobe and ENBW figures of merit.
  • Avoid inventing discontinuities — don’t hard-clip spectra or idealize filters as perfect rectangles unless you accept the ripples.

Matlab demonstration (truncated sinc → frequency ripple)

The following constructs a truncated Nyquist sinc and shows how the DFT of that impulse response rings — the FIR dual of Gibbs. Change Nsym to match Figures 3–5.

% Gibbs dual: truncated sinc (ideal LPF impulse) → ripples in frequency
Nsym = 15;          % filter span in symbols
L = 16;             % samples per symbol
n = -Nsym*L/2 : Nsym*L/2;
h = sinc(n/L);      % MATLAB sinc = sin(pi x)/(pi x)
h = h / sum(h);     % unity DC gain
Nfft = 4096;
H = fftshift(abs(fft(h, Nfft)));
f = (-Nfft/2:Nfft/2-1)/Nfft;   % cycles/sample
plot(f, 20*log10(H/max(H) + 1e-12));
grid on; xlabel('Normalized frequency'); ylabel('|H| (dB)');
title(sprintf('Truncated sinc, Nsym = %d (Gibbs in frequency)', Nsym));

Python demonstration (square-wave partial sums)

import numpy as np
import matplotlib.pyplot as plt

def square_partial(t, N):
    """First N odd harmonics of the ±1 square wave."""
    s = np.zeros_like(t, dtype=float)
    for k in range(N):
        n = 2*k + 1
        s += np.sin(n*t) / n
    return (4/np.pi) * s

t = np.linspace(-np.pi, np.pi, 4000)
for N in (3, 9, 30):
    plt.plot(t, square_partial(t, N), label=f'N={N}')
plt.plot(t, np.where(t > 0, 1.0, -1.0), 'k--', alpha=0.4, label='target')
plt.ylim(-1.4, 1.4); plt.grid(True); plt.legend()
plt.title('Gibbs phenomenon: square-wave Fourier partial sums')
plt.xlabel('t'); plt.show()
# Overshoot fraction ≈ (max near 0+) - 1) / 2  → approaches ~0.0895

Or skip the local plot and drive the same experiment in the browser: N = 9 vs N = 30.

Connection to spectral leakage and windows

Gibbs, leakage, and window sidelobes are one family. Rectangular truncation ↔ Dirichlet kernel ↔ slow sidelobe decay. A Hann or Kaiser window replaces that kernel with a smoother one: wider main lobe, lower sidelobes, less overshoot. Walk the path in order — series foundations, this article, FFT leakage, then window FoM — and the vocabulary stays consistent.

FAQ

Does more terms fix Gibbs? They narrow the ringing zone proportional to 1/N. The relative overshoot for rectangular truncation asymptotes to ≈8.95% of the jump, not to zero.

Is the series “wrong” at the jump? No. At a jump the Fourier series converges to the average of the left and right limits. The overshoot lives in neighborhoods shrinking toward the jump, not at the single jump point in the limit.

Related to leakage? Same truncation mechanism, different classroom framing. Leakage is the DFT/window story for sinusoids; Gibbs is the jump / brick-wall story.

How do FIR designers escape it? They rarely use bare rectangular truncation for sharp specs. Windows, Parks–McClellan equiripple design, and least-squares methods place ripple deliberately instead of accepting Dirichlet sidelobes.

Where is the interactive tool? /tools/gibbs-phenomenon-demo/ — also linked from the Fourier path box at the top of this page.

Similar articles

References

H. Wilbraham, “On a certain periodic function,” Cambridge and Dublin Mathematical Journal, 1848.

J. W. Gibbs, letters in Nature, 1898–1899.

A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing — discussions of windowing and the frequency response of truncated ideal filters.

T. W. Körner, Fourier Analysis — classical treatment of partial sums and the Gibbs phenomenon.

2 thoughts on “Gibbs phenomenon — overshoot at Fourier discontinuities”

Leave a Comment