Electrical & Computer

Fourier Lab

Any periodic signal is a sum of sinusoids — Fourier's big idea, made tangible. Pick a waveform and add harmonics one at a time; the green partial sum climbs toward the ideal shape. The smooth triangle locks on fast (its coefficients fall off as 1/k²), while the jumpy square crawls — and never fully settles: the Gibbs overshoot near each edge stubbornly stays around 9% no matter how many terms you add. Flip on the component sinusoids to see exactly what's being summed.

5 harmonics · the green partial sum approaches the dashed target — note the Gibbs overshoot that never quite goes away at the jumps.

The method, with your numbers

Fourier series synthesis

  1. 1

    Write the Fourier sine series for the square wave

    f(t) = (4/π)·Σ sin(k·t)/k (k = 1, 3, 5, …)

    prefactor 4/π = 1.27

    The wave is odd (sines only) with half-wave symmetry — so every even harmonic vanishes.

  2. 2

    Compute the leading coefficients

    bₖ = 4/(π·k) (k odd)

    b₁ = 1.27 b₃ = 0.42 b₅ = 0.25

    Amplitudes fall like 1/k — slow decay, so the sharp edges need many harmonics.

  3. 3

    Find the highest harmonic in your sum

    k_max = 2·N − 1 (odd k only)

    k_max = 2·5 − 1 = 9

    Your sum stops at sin(9·t) — the finest wiggle the green curve can draw. Drag the slider and watch the edges sharpen.

  4. 4

    Sum the sinusoids (what the canvas draws)

    f_N(t) = Σ bₖ·sin(k·t) — evaluate at t = π/2

    f(π/2) = 1.27·sin(π/2) + … = 1.06 (ideal: 1)

    The green curve is exactly this sum, evaluated at 400 points across two periods.

  5. 5

    Measure the leftover error at t = π/2

    ε = |f_N(π/2) − f(π/2)|

    ε = |1.06 − 1| = 0.063

    More terms shrink this mid-point error, but right at the jumps the overshoot never drops below ≈ 9% of the step — the Gibbs phenomenon. Look at a jump and keep adding harmonics.

Drag any control above — every number here recalculates. Want this method for any problem? Step Sheets →

Waveform

Harmonics5

Any periodic signal is a sum of sine waves. Add harmonics and the partial sum sharpens toward the target — fast for the smooth triangle (1/k²), slowly for the jumpy square, where the Gibbs overshoot stubbornly stays near 9%.

How to use this simulation

Any periodic signal is a sum of sinusoids — Fourier's big idea, made tangible. Pick a waveform and add harmonics one at a time; the green partial sum climbs toward the ideal shape. The smooth triangle locks on fast (its coefficients fall off as 1/k²), while the jumpy square crawls — and never fully settles: the Gibbs overshoot near each edge stubbornly stays around 9% no matter how many terms you add. Flip on the component sinusoids to see exactly what's being summed.

Everything runs in your browser — no sign-up, no download. Change a value and the result updates instantly, so you can build a feel for how each input shapes the outcome. It pairs with Crameleon's practice exams and step sheets when you want to go from intuition to working the problems.