Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Fourier Series Visualizer

Choose a square, sawtooth, triangle, or half-wave rectified sine, then add harmonic terms with the slider. The N-term partial sum updates instantly over the target wave, the spectrum shows each harmonic amplitude, and the Gibbs overshoot near a jump is marked. Useful for high school precalculus, AP physics, signals and systems, and intro differential equations.

Target waveform

Odd wave, +1 on (0, pi) and -1 on (-pi, 0). Built from sine harmonics with odd n only.

Add more terms to refine the approximation. Watch it converge toward the target almost everywhere, while the overshoot near a jump stays put.

Approximation versus target

TargetN-term sum
-1.0-0.50.00.51.0-pi-pi/20pi/2pi3pi/22piGibbs overshoot: peak 1.123, about 12.3% above the target+12.3% overshootx (radians)

The red dot marks the Gibbs overshoot near the jump. Adding terms narrows the spike but never removes the roughly 9% overshoot.

Harmonic spectrum

5 harmonics shown
harmonic 1: amplitude 1.273212harmonic 3: amplitude 0.424434harmonic 5: amplitude 0.25465harmonic number namplitude

Bars above the line are positive coefficients, bars below are negative. Missing bars are harmonics with zero amplitude. The amplitudes shrink as n grows, which is why a finite sum can approximate the wave.

Square series

Fourier series
f(x) = (4 / pi) [ sin(x) + sin(3x)/3 + sin(5x)/5 + ... ]
Terms summed
N = 5
Gibbs overshoot
peak 1.123
about +12.3% above target
Takeaways
  • Any periodic wave is a sum of sines and cosines whose frequencies are whole-number multiples of the fundamental.
  • More terms means a closer fit almost everywhere, because the higher harmonics add finer detail.
  • Near a jump the partial sum overshoots by roughly 9% no matter how many terms you add. The spike only gets narrower, not shorter. This is the Gibbs phenomenon.

Reference Guide

What a Fourier series is

A Fourier series writes a periodic function as a sum of sines and cosines. Each term oscillates at a frequency that is a whole number multiple of the fundamental, so the building blocks are perfectly periodic too.

This tool uses the period 2 pi on the interval from minus pi to pi. The square and sawtooth waves are odd, so they need only sines. The half-wave rectified sine needs a constant offset plus a sine and even cosine terms.

Harmonics and amplitudes

The coefficient of each harmonic tells you how much of that frequency the wave contains. The spectrum bar chart plots these amplitudes against the harmonic number n.

  • Square wave. Odd harmonics only, amplitudes falling like 1 over n.
  • Triangle wave. Odd harmonics only, amplitudes falling like 1 over n squared, so it converges fast.
  • Sawtooth wave. All harmonics, with alternating signs.

Amplitudes that shrink quickly mean fewer terms are needed for a good fit.

Convergence and partial sums

A partial sum keeps the first N harmonics and drops the rest. As N grows, the partial sum gets closer to the target almost everywhere, because the leftover high-frequency terms carry less and less energy.

At points where the wave is smooth, the approximation tightens steadily. Drag the term slider and watch the solid curve settle onto the dashed target between the jumps.

The Gibbs phenomenon

Near a jump discontinuity the partial sum overshoots the target by roughly 9 percent of the jump size. The square and sawtooth waves both show this red marker.

Adding more terms makes the overshoot spike narrower, but it never makes it shorter. The peak stays near the same height no matter how large N gets. That stubborn overshoot is the Gibbs phenomenon, and it is a real limit of representing a sharp edge with smooth sine waves.

Related Content