SimuVeda/ Mathematics

Mathematics · Simulator 043

Fourier Synthesis

Add sine waves together, one harmonic at a time, and watch a square, sawtooth or triangle wave emerge. Set your own harmonic amplitudes, compare the waveform with its frequency spectrum, and find the stubborn overshoot at sharp jumps.

CollegeFourier series: college mathematics and engineering

Experiments 0 of 0 Challenge not tried

How the model works

Any reasonable periodic signal can be written as a sum of sines and cosines at whole-number multiples of its fundamental frequency (a Fourier series):

f(t) = Σₙ bₙ sin(2π n t / T)

  • Square wave: odd harmonics only, bₙ = 4/(nπ). Amplitudes fall slowly as 1/n.
  • Sawtooth: all harmonics, bₙ = 2(−1)ⁿ⁺¹/(nπ).
  • Triangle: odd harmonics with alternating sign, bₙ = 8(−1)^((n−1)/2)/(n²π²). They fall fast as 1/n², because the wave has no jumps, only corners.

The smoother the wave, the faster its harmonics shrink. At a jump, partial sums always overshoot by about 9% of the jump, however many terms you add. This is the Gibbs phenomenon: the overshoot gets narrower but not shorter.

The spectrum chart shows |bₙ| for each harmonic (a line spectrum). In audio, these harmonics are what make a note sound like a flute (few harmonics) or a buzzy synthesiser (many).

Sine-only (odd-symmetric) series; the custom mode lets you set the first eight amplitudes. No sound is played.

Guided experiments

  1. Build a square wave. Increase harmonics from 1 to 25. Prediction: the sum flattens and sharpens. With 1 term it is a pure sine of height 4/π ≈ 1.27.
  2. Gibbs overshoot. Square wave with 99 harmonics. Prediction: the peak near the jump stays at about 1.18 (9% of the 2-unit jump above 1), not 1.0.
  3. Triangle converges faster. Triangle with 5 harmonics. Prediction: already almost perfect. The maximum error is about 3% of the peak, versus visible ripples for a square wave with the same count.

Challenge

A square wave and a triangle wave both have the fundamental amplitude b₁ at n = 1. How much weaker is the 9th harmonic than the fundamental in each?

Reveal the explanation

Square: bₙ ∝ 1/n, so the 9th is 1/9 ≈ 11% of the fundamental. Triangle: bₙ ∝ 1/n², so 1/81 ≈ 1.2%. That is why a triangle wave sounds much softer and purer than a square wave at the same pitch.

References

  • OpenStax, Calculus Volume 3 (series) and MIT OpenCourseWare 18.03, “Fourier series”.
  • Gibbs, J. W. (1899), letter in Nature 59: 606.

Related simulators

Worked example

Square wave of height ±1: bn = 4/(nπ) for odd n, so b₁ ≈ 1.273, b₃ ≈ 0.424, b₅ ≈ 0.255.

At the middle of the top (t = T/4) the sines are +1, −1, +1, so three terms give 1.273 − 0.424 + 0.255 ≈ 1.10. More terms bring it closer to 1.

Energy: the fundamental alone carries b₁²/2 ≈ 0.81 of the square wave's power, 81%. The rest is spread over the higher harmonics.

Triangle wave: b₁ = 8/π² ≈ 0.811 but b₃ = −8/(9π²) ≈ −0.090, nine times smaller, because triangle harmonics fall as 1/n² instead of 1/n. That is why a triangle sounds much softer than a square wave.

Choose the square wave and set the highest harmonic to 5, then to 25.

Common questions

What is a Fourier series?

A way of writing a repeating signal as a sum of sine waves at whole-number multiples of its basic frequency. Each sine's amplitude says how much of that harmonic the signal contains.

Why does a square wave only have odd harmonics?

A square wave looks the same, flipped upside down, half a period later. Even harmonics do not have that symmetry, so their coefficients come out zero.

What is the Gibbs phenomenon?

Near a sudden jump, a Fourier sum always overshoots by about 9% of the jump size. Adding more terms makes the overshoot narrower but never smaller.

Keyboard shortcuts

Space
Play or pause
S
Step
R
Reset
F
Full screen
?
Show this list