The additive synthesis, through Fourier series, of square, sawtooth and triangle waves
I just updated these three animations. The old ones I had on Wikipedia were among the first I’ve ever done, and were ugly, tiny and outdated.
What you’re seeing here is how a periodic function (in blue) can be approximated by a Fourier series (in red). The number N shows how many terms are being used.
A Fourier series is just a sum (usually infinite) of sines and cosines of different frequencies and amplitudes that approximates a desired function. These frequencies and amplitudes constitute what we call the frequency domain of the function, though this is more useful when we consider a continuous spectrum of frequencies.
The function doesn’t need to be continuous, as you can see in the case of the square and the sawtooth wave.
However, the Fourier series approximation does get a bit wacky around the discontinuities. The wavyness near those points never really goes away, but it usually stays within a certain limit. This is known as Gibbs phenomenon, and it’s a familiar problem in signal processing.
Due to the simplicity of sines and cosines, Fourier series are a great tool when studying the behavior of more complicated periodic functions, a common problem in differential equations with extremely wide applications in physics and engineering.
An important aspect of all of this that gets brushed over in most classes is that you don’t really need both sines and cosines in a Fourier series, since the sum of a sine and a cosine of the same frequency is just a senoidal function with a different phase and amplitude. In other words, you only use sine and cosines in order to encode a phase.
This is why Fourier series are much more elegantly handled using complex numbers, as the complex exponential can handle both phase and amplitude very succintly.
In the future I’m hoping to make a post explaining, in terms most people with a basic understanding of math can understand, why all of this Fourier analysis stuff works in the first place, and why you should think it is awesome. Because it is very awesome.
Previous posts on Fourier analysis