Fourier Series and Gibbs Phenomenon
Approximate a square wave and visualize the Gibbs Phenomenon.
By Riano · Published · Updated · Report a correction
Fourier Series and Gibbs Phenomenon
Concept Overview
The Gibbs Phenomenon describes the peculiar manner in which the Fourier series of a piecewise continuously differentiable periodic function behaves at a jump discontinuity. Specifically, the partial sums of the Fourier series exhibit large oscillations near the jump, which overshoot the function's values. Even as the number of terms approaches infinity, this overshoot does not disappear; instead, the peak of the overshoot moves closer to the discontinuity but its height approaches a non-zero limit of approximately 8.949% of the jump.
Mathematical Model
Consider a 2π-periodic square wave defined by:
The jump at θ = 0 is 2A (from -A to A). The Fourier series partial sum SN(θ) with N non-zero odd terms is given by:
The first positive peak of SN(θ) occurs exactly at θ = π / (2N). The percentage overshoot is the peak's excess above A, divided by the jump size 2A.
Worked Example
Let's calculate the approximation for 1 term and then 3 terms, given A = 1 and Probe θ/π = 0.5.
Learn more about the Gibbs Phenomenon below:
- For N = 1: The sum is (4/π)sin(θ). At θ = 0.5π, sin(0.5π) = 1. S1(0.5π) = 4/π ≈ 1.2732. The peak is at π / (2·1) = 0.5π. The excess is (4/π) - 1, and as a percentage of the jump (2): ((4/π - 1) / 2) × 100% ≈ 13.66%.
- For N = 3: S3(θ) = (4/π) · [sin(θ) + sin(3θ)/3 + sin(5θ)/5]. At θ = 0.5π, we have sin(0.5π) = 1, sin(1.5π) = -1, and sin(2.5π) = 1. S3(0.5π) = (4/π) · (1 - 1/3 + 1/5) = 52 / (15π) ≈ 1.1035. The first peak occurs at π / (2·3) = π/6. Evaluating S3(π/6) = (4/π) · [1/2 + 1/3 + 1/10] = 56 / (15π) ≈ 1.1884. The percentage overshoot is ((56/(15π) - 1) / 2) × 100% ≈ 9.42%.
Experiment
You can verify this in the Fourier Series and Gibbs Phenomenon module.
- Set the Amplitude A to
1. - Set the Odd-term count N to
1. - Set the Probe theta / pi to
0.5. - Observe the partial sum is approximately
1.2732and the peak overshoot is13.66%. - Now set Odd-term count N to
3. The peak moves to0.167π, but the overshoot remains around9.42%. - Set Odd-term count N to 2 while Amplitude A = 1 and Probe theta / pi = 0.5. The sum is 8/(3π), about 0.848826363157, while the first peak is 8√2/(3π), about 1.20042175488.
- Set Odd-term count N to 20. The near-jump plot marks the first peak at theta / pi = 0.025 and computes its excess rather than forcing the limiting percentage.
- Set Probe theta / pi to 0, then -1 and 1. Target midpoint and sum are 0 at each jump. This convention does not mean the continuous finite sum reproduces the one-sided limits there.
- Set Amplitude A to 0. Target, sum, peak value and error are 0, while normalized overshoot is unavailable. Restore A = 1, clear Odd-term count N, observe the error and absent outputs, then restore N = 1.
Limitations
The simulation uses a finite sum up to N = 20. The asymptotic 8.95% overshoot is the theoretical limit as N → ∞ and is not artificially forced on finite calculations here. Displayed decimals have eleven significant digits and calculations use floating-point arithmetic. The input theta / pi is dimensionless; sine receives the corresponding angle in radians. Error means absolute difference from the declared target. The two plots have independent labelled scales; target jump segments are drawn separately, with midpoint markers. At amplitude 0 the wave is flat, so there is no isolated first peak. The N used here counts terms; the cited source indexes its terms from 0 through N, so its N + 1 equals this module’s term count.
References
Learn more about the Gibbs Phenomenon below:
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Fourier Series and Gibbs Phenomenon module.
Try Fourier Series and Gibbs Phenomenon on Riano →