The Fourier Series and Harmonic Approximation¶

In this article, we will walk through the origins of the Fourier transform: the Fourier Series. The Fourier series takes a periodic signal $x(t)$ and describes it as a sum of sine and cosine waves. Noting that sine and cosine are themselves periodic functions, it becomes clear that $x(t)$ is also a periodic function.

Mathematically, the Fourier series is described as follows. Let $x(t)$ be a periodic function with period $T$, i.e.

$$x(t)=x(t+nT), n\in\mathbb{Z}.$$

Then, we can write $x(t)$ as a Fourier series by

$$x(t)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos(2\pi \frac{nt}{T})+b_n\sin(2\pi\frac{nt}{T}),$$

where $a_n$ and $b_n$ are the coefficients of the Fourier series. They can be calculated by $$\begin{align}a_n&=\frac{2}{T}\int_0^Tx(t)\cos(2\pi \frac{nt}{T})dt\\ b_n&=\frac{2}{T}\int_0^Tx(t)\sin(2\pi \frac{nt}{T})dt\end{align}.$$

Note that for a function with period $T$, the frequencies of the sines and cosines are $\frac{1}{T}, \frac{2}{T}, \frac{3}{T}, \dots$, i.e. they are multiples of the fundamental frequency $\frac{1}{T}$, which is the inverse period duration of the function. Therefore the frequency $\frac{n}{T}$ is called the $n$th harmonic. The name harmonic stems from the fact for the human ear frequencies with integer ratios sound "nice", and the frequencies are all integer multiples of the fundamental frequency.

Let us verify the calculation of the Fourier coefficients and the function reconstruction numerically. First, we define some functions with period $T=1$ that we want to expand into a Fourier series: