MATLAB code to demonstrate [Fourier series][1] representation of periodic signals (as a sum of sinusoidal functions).
The animation shows an approximation of a square wave signal using the first 4-terms of its Fourier series. (Change the parameters near the top of the code to manipulate the animations and explore other variations).
![animation1][6] ![animation2][7]
This was inspired by the following similar animations:
- [Fourier Series Animation using Circles][2]