About this experiment
Joseph Fourier showed that any repeating signal can be built from sine waves whose frequencies are whole-number multiples of the lowest one. A square wave, with its sudden jumps, is made of the odd harmonics with amplitudes 1, 1/3, 1/5 and so on. Add harmonics one by one and watch the sum get closer to the target, see the same sum as a chain of rotating circles, listen to how the sound gets brighter, and discover the stubborn overshoot near each jump known as the Gibbs phenomenon.
Learning goals
- Write a periodic function as a sum of sine harmonics with Fourier coefficients
- Recognise which harmonics are present in square, sawtooth and triangle waves, and how fast their amplitudes fall
- Explain how the partial sum converges and why smooth waves need fewer harmonics
- Describe the Gibbs phenomenon at a jump discontinuity
- Relate the harmonic content of a wave to its timbre
How to use it
- 1Start with the square wave and N = 1. Increase N one step at a time up to 9. Which harmonics change the picture, and which do nothing?
- 2Set N to 50. Look closely at the jumps. Does the overshoot shrink as N grows? Read its size.
- 3Switch to the triangle wave. How many harmonics do you need for an RMS error below 0.01? Compare with the square wave.
- 4Switch to Rotating circles. Explain how the circles produce the wave.
- 5Press Hear it at 220 Hz and change N. Then compare the square, sawtooth and triangle waves by ear.
- 6Choose Your own and drag the bars to build a wave. Can you make one that sounds like a different instrument?
The model
Assumptions
- All waves have period 2π and amplitude 1 and are odd functions, so only sine terms appear.
- Coefficients are the exact closed forms, not computed from samples. The RMS error is found by sampling one period at 2000 points.
- The sound plays the same amplitudes at a fundamental of 220 Hz. The browser scales the loudness of the whole wave, so changing N does not make it much louder or quieter.
Try this in class
- Q1Why does the square wave contain no even harmonics?
- Q2The triangle wave needs far fewer harmonics than the square wave for the same accuracy. Explain this in terms of how smooth the two waves are.
- Q3Why does adding more harmonics not remove the overshoot near the jumps of the square wave?
- Q4A clarinet sound is rich in odd harmonics. Which of the three waves does it most resemble?
- Q5Telephone lines once passed frequencies up to about 3400 Hz. How many harmonics of a 220 Hz square wave would get through?
Frequently asked questions
What is a harmonic?
A harmonic is a sine wave whose frequency is a whole-number multiple of the fundamental frequency. The first harmonic is the fundamental itself; the second has twice its frequency, and so on.
What is the Gibbs phenomenon?
Near a sudden jump, the partial sums of a Fourier series overshoot the target by about 9 % of the jump. With more harmonics the overshoot gets narrower and moves closer to the jump, but its height stays the same.
How are the rotating circles related to the series?
Each term b_k sin(kx) is the height of a point moving round a circle of radius |b_k| at k times the basic speed. Adding the circles tip to tail adds the terms, so the height of the last tip is the partial sum.