Visualize the Fourier Series as a Sum of Harmonics

Interactive Fourier series visualization: set a fundamental frequency, choose up to four cosine harmonics with their own amplitude and phase, then add them one at a time and watch a periodic signal appear from its weighted harmonics.

This interactive Fourier series visualization shows where a periodic signal actually comes from: it is nothing more than a weighted sum of cosines sitting at whole-number multiples of one fundamental frequency. Set the fundamental f0, choose two, three, or four harmonics, and give each one its own harmonic number, amplitude, and phase. The stack of plots then reads exactly like the equation, one strip per harmonic joined by plus signs, with the signal they add up to on the bottom row.

Press Play and the harmonics join the sum one at a time. The row for the arriving harmonic lights up out of the dim, a shaded band on the bottom plot marks exactly what that term contributed, and the running total morphs smoothly into its new shape while a dashed ghost shows where the finished signal is heading. You can step through the animation one harmonic at a time in either direction, scrub up and down the stack, or drag the progress slider. The synthesis equation below the plots fills in term by term as you go, each term colored to match its own plot.

Five presets each teach something different. The square wave shows how odd harmonics with alternating phase build flat tops, and why three or four terms leave a visible ripple that no slider setting removes. The sawtooth uses consecutive harmonics with amplitudes falling off as 1/n. Phase matters keeps exactly the same amplitudes as the square wave and changes only the phases, producing a completely different waveform from an identical amplitude spectrum. Harmonic 0 is DC demonstrates that a harmonic number of zero does not oscillate at all and simply lifts the whole signal off the axis. The last preset rides a small fast ripple on a slow fundamental.

The metrics let you check the theory numerically rather than take it on faith. The period tile confirms T = 1/f0, the peak tile can never exceed the sum of the amplitudes, and the live strip checks Parseval's relation by comparing the measured RMS of the current partial sum against the closed form built from the amplitudes alone. Watching those two numbers stay equal as each harmonic joins is a direct demonstration that power adds up term by term across harmonics.