Fourier three

I’ve been having some fun visualizing Fourier series. Here are three periodic functions:

Three waveformsThe first is a sawtooth. The second is a sampled-and-held version of the same; these are analogous to what might go into and come out of a digital recording system, before any filtering. The third looks quite different but is related: in the second function the height of each step samples the first, while in the third the width of each pulse samples the first. It’s analogous to what one gets from a PWM (pulse width modulation) circuit, like the one that provides “analog” outputs on an AVR microcontroller.

Even knowing intellectually the connection between the three, I find it viscerally surprising that the first several terms of the Fourier series for all three are very similar. Sum the first four terms of each and you get the functions in blue:

4 termsHere are six terms:

6 termsThey’re still pretty similar, though the third is getting more wiggly. This illustrates how you can put the output of a DAC (digital to analog converter) or a PWM through a low pass filter and reproduce the original analog signal, or at least a bandlimited version thereof.

Add the seventh term and you see the third function start to go its separate way from the first two:

7 terms


The underlying sawtooth amplitude is still visible but the wiggles are starting to dominate. Now the eighth term:

8 termsNow the sawtooth amplitude is starting to disappear. At 12 terms the second function is noticeably more jagged than the first:

12 termsWith 16 terms the stairsteps of the second function and the varying pulse widths of the third are becoming evident:

16 termsHere’s 32 terms:

32 termsand 64:

64 termsThey start out so similar and end up so different. Hard work and perseverance, grim determination of the soul?

Here’s an animation of the whole thing.










One thought on “Fourier three

  1. Hi, I would like to know more about how the three fourier series sum up to give three different waveforms TECHNICALLY. Could you give us more technical/mathematical insights of using PWM and low-pass to achieve DAC ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s