loading...
Gibbs phenomenon: peak of the partial square-wave sum against N (red: the limit 1.179)
RMS error of the truncated series against the number of harmonics kept (grey: Parseval tail)
Square wave with 49 harmonics: the overshoot does not shrink (Gibbs). Beats: set f2/f near 1.1. Phase 90 degrees: sine becomes cosine.
running...
The science
The sine curve. A sinusoid is y(t) = A sin(2 pi f t + phi) + c: amplitude A, frequency f (period T = 1/f), phase phi and offset c. Its slope is A w cos(w t + phi) with w = 2 pi f, its mean is c and its rms value (without the offset) is A / sqrt(2).
Phasors. The sine is the vertical shadow of a point moving on a circle of radius A with angular speed w. Several sines add as arrows placed tip to tail (the chain on the left): the signal is the height of the last tip. In three dimensions the same chain, drawn against time, is a helix and the sine is its projection onto a wall.
Fourier series. Any periodic wave is a sum of harmonics sum a_n sin(n w t + phi). The page uses
square: a_n = 4A / (pi n), n odd sawtooth: a_n = (2A / (pi n)) (-1)^(n+1) triangle: a_n = (8A / (pi^2 n^2)) (-1)^((n-1)/2), n odd
Parseval's theorem says the mean square of the signal equals sum a_n^2 / 2, so the rms error of a series cut at N is the square root of the omitted tail. Near a jump the partial sums overshoot by about 8.95 % of the jump (the Gibbs phenomenon) however many terms are kept; for a square wave of amplitude A the peak tends to (2/pi) Si(pi) A = 1.179 A.
Honest simplifications. The time axis scrolls and the amplitudes are dimensionless; the beat envelope is only meaningful when the two frequencies are close. RMS and mean are measured over ten periods of the fundamental, which is exact for a single periodic wave and approximate for two incommensurate tones. The Gibbs plot always uses a unit square wave.
Checks run in the page. The numerical rms of a sine equals A / sqrt(2); a numerical integral of one half cycle equals 2A / w; a central-difference derivative equals A w cos(w t + phi); Parseval's sum equals the measured power for the current wave; the partial square-wave peak at N = 199 equals 1.17898.