How to build square, triangle, and sawtooth waves from sine waves.

The whole point of Fourier’s great discovery is that you can express, break down, decompose all sorts of waves as sums of pure sine waves. That’s the *analysis* direction. The *synthesis* direction says that you can take sine waves and build up any other kind of periodic function. This page looks at the process for three familiar kinds of waves.

ℱ→

- Square wave:
- Triangle wave:
- Sawtooth wave:

To get exactly sharp edges in the time function, you need an infinite number of terms. Obviously, we are not going to get that in a discrete Fourier transform, where time series and spectra are both finite in length. But you can still see the process, and watch the shapes converge. For the examples, we start with a base frequency of 4. Notice how discontinuities of slope (as with the triangle wave) converge nicely, but discontinuities of value (with the other two waves) converge to the midpoint between the two extremes.

For the square wave, only every other harmonic is used; here that means ν = 4, not 8, 12, not 16, 20, not 24, and 28. (These are called the odd harmonics because they are odd multiples of 4, but it can be confusing to call them odd when they are all even numbers.) The amplitude of the spectrum goes down as 1/ν (-6 dB/octave); you can still see the tiny fourth-order blips in the spectrum at ν=28.

For the triangle wave, we still use only the odd harmonics, but the amplitude goes down as 1/ν² (-12 dB/octave) and it’s pretty hard to even see the fourth-order contribution. The sine components also alternate in polarity. Because the denominator grows faster, this series converges more rapidly, and looks very triangular.

For the sawtooth wave, we use all the harmonics, i.e. ν = 4, 8, 12, 16... So we have room for a few more terms. The spectrum’s amplitude goes down as 1/ν, and the components alternate in polarity.

Previous ☜ Navigate through the DSP pages ☞ Next