Gibbs Phenomenon Demo

Gibbs phenomenon demo

Two dual experiments, one page. Time / zoom / spectrum truncate a Fourier series near a jump (classic Gibbs). FIR dual truncates an ideal low-pass sinc and shows the same ringing in |H(f)|. Controls that do not apply to the current view are hidden.

Loading…
This switch picks which experiment (and which sliders) are active.
Jumps → ~9% overshoot. Continuous triangle → overshoot → 0 as N grows.
How many Fourier terms to keep. Larger N narrows ringing; relative overshoot stays ~9% (no taper).
In series views: tapers coefficients. In FIR view: windows the truncated sinc.
Only for Rectangular pulse: high-time fraction of one period (0.25 = 25% pulse width).
Length of the truncated sinc: keep ±span symbols at 16 samples/symbol. Longer → sharper transition in H(f); ripple height stays similar unless you add a taper.
Measured overshoot (fraction of jump) —
Asymptotic Gibbs constant Si(π)/π − ½ 8.949%
Approx. ringing half-width —
Peak reconstruction / note —

Partial Fourier sum vs target

Series demo: View = Time or Zoom, Waveform = Square, Taper = None. Sweep Harmonics N — ripples pack against the jump, overshoot % barely moves.

FIR demo: View = FIR dual. Sweep FIR span from 4 → 30 — the transition around the dashed cutoff gets steeper; passband ripple % stays in the Gibbs ballpark until you change Taper.

Full write-up: Gibbs phenomenon article.

Controls explained

View
Time — one period of the target (dashed) and the truncated Fourier sum (solid). Zoom — same, magnified at the first jump so you can see the overshoot peak. Spectrum — bar chart of retained |cₖ| after taper. FIR dual — ignore the waveform; instead truncate an ideal LPF sinc and plot |H(f)| near the cutoff (Gibbs in frequency).
Waveform
Chooses which periodic signal’s Fourier series you truncate. Square and sawtooth have jump discontinuities → classic Gibbs. Pulse has two jumps per period (duty cycle sets width). Triangle is continuous → overshoot vanishes as N increases (control case).
Harmonics N
Number of terms kept in the partial sum (for square/triangle: N odd harmonics). Effect: ringing width ~ π/N shrinks; with rectangular truncation the relative overshoot asymptotes to ≈8.95% of the jump, not to zero.
Taper / window
None = hard rectangular cut (full Gibbs). Lanczos and Hann multiply coefficients (series views) or the sinc taps (FIR view) by a smooth window — overshoot/ripple drops, edges/transitions get softer. Same trade-off as windowed FIR design.
Pulse duty cycle
Only for Rectangular pulse. Fraction of the period that the pulse is high (e.g. 0.25 ⇒ on for a quarter period). Changes which cosine coefficients are strong; does not apply to square/saw/triangle or to FIR view.
FIR span (symbols)
Only for FIR dual view. Ideal low-pass impulse response is a sinc; this keeps ±span symbols (16 samples/symbol). Longer span → narrower transition band around the cutoff. It does not remove Gibbs ripple by itself — that needs a taper/window. Inactive in Time/Zoom/Spectrum (those use Harmonics N instead).

How to use this demo

Treat the page as two labs. In Time / Zoom / Spectrum, you truncate a Fourier series: Waveform, Harmonics N, and Taper matter; FIR span is hidden because it is unused. In FIR dual, you truncate an ideal low-pass sinc: only FIR span and Taper matter — longer span steepens the transition around the dashed cutoff; taper (not span alone) is what shrinks passband ripple.

Quick check that span works: open FIR dual, span = 4, then span = 30. The transition width number and the slope at the cutoff should both change; the ripple percentage stays near the Gibbs ballpark until you switch taper to Hann or Lanczos.

Read next

FAQ

Why didn’t FIR span do anything before? It only applies in the FIR dual view. In Time/Zoom/Spectrum the active length parameter is Harmonics N. The updated UI hides inactive controls and explains each one under “Controls explained.”

Why doesn’t adding harmonics remove the overshoot? Convergence is pointwise away from jumps and in the L² sense, but near a jump the partial sums approach the Dirichlet integral whose first lobe sits a fixed fraction above the jump. More terms only squeeze that lobe closer to the discontinuity.

Is Gibbs the same as spectral leakage? Same root cause — abrupt truncation — different viewpoint. Gibbs is the classic Fourier-series / brickwall-filter ringing story; leakage is the DFT view when a non-periodic window cuts a sinusoid.