Part 5 - Fourier series

Posted on Sep 15, 2023
(Last updated: May 26, 2024)

Introduction

In this part we’ll try to understand the concept and power with Fourier series.

Let’s firstly define the what, why and how with Fourier series.

Definition

Fourier series, is an expansion of a perodic function, into a sum of trigonometric functions.

So the power is really, given a complex perodic function, we can easily represent it as a sum of simple trigonometric functions!

However, before we mathematically define the Fourier series, let’s take a different approach to this.

Signal representation by orthogonal signal set

We can see that, if we only use $c_1 x_1$ and $c_2 x_2$, we get something similar for $f$.

We can say that: $$ f \sim c_1 x_1 + c_2 x_2 $$

Let’s call our error, $e$. $$ e = f - (c_1 x_1 + c_2 x_2) $$

Therefore: $$ f \sim c_1 x_1 + c_2 x_2 + e = c_1 x_1 + c_2 x_2 + c_3 x_3 \ | \ \text{in this case} $$

From linear algebra we know that basis vectors are orthogonal, this means: $$ c_i = \dfrac{f \cdot x_i}{x_i \cdot x_i} = \dfrac{1}{|x_i|^2} f \cdot x_i $$

This is really useful, so, from what we know, we can say that.

Given a set of orthogonal real signals, $x_1(t), x_2(t), \ldots, x_N(t)$ over the interval, $[t_1, t_2]$: $$ \int_{t1}^{t2} x_m(t)x_n(t)\ dt = \begin{cases} 0 & m \neq n \newline E_n & m = n \end{cases} $$

We can approximate, $f(t)$ over the interval, $[t_1, t_2]$ as: $$ f(t) \sim c_1 x_1(t) + c_2 x_2(t) + \ldots \ c_N x_N(t) = \sum_{n = 1}^N c_n x_n(t) $$

For any $c_n$ we can express it as an integral: $$ c_n = \dfrac{\int_{t_1}^{t_2} f(t) x_n(t)\ dt}{\int_{t_1}^{t_2} x_{n}^2 (t)\ dt} = \dfrac{1}{E_n} \int_{t_1}^{t_2} f(t) x_n(t)\ dt $$

As before, we will have an error, $e(t)$ as well: $$ e(t) = f(t) - \sum_{n = 1}^N c_n x_n(t) $$

We’ll also have an error in the energy, defined as: $$ E_e = \int_{t_1}^{t_2} f^2(t)\ dt - \sum_{n = 1}^N c_n^2 E_n $$

As, $N \to \infty$, we hope that both of these go to zero.

This is the generalized Fourier series!

Let’s define it properly

Generalized Fourier series definiton

$$ f(t) = c_1 x_1(t) + c_2 x_2(t) + \ldots \ c_N x_N(t) = \sum_{n = 1}^N c_n x_n(t) $$

If, $E_e \to 0$ as $N \to \infty$, the set $\{x_n(t)\}$ is a complete set on the interval $[t_1, t_2]$, for that class of $f(t)$.

$\{x_n(t)\}$ are called basis functions or basis signals.

Parseval’s Theorem

The error energy can approach zero even though $e(t)$ is non-zero at some isolated instants. $$ \int_{t_1}^{t^2} f^2 (t)\ dt = c_1^2 E_1 + c_2^2 E_2 + \ldots = \sum_{n = 1}^{\infty} c_n^2 E_n $$

Generalization to complex signals

In the most general case, signals are considered to be complex function.

Therefore, let’s generalize further to the complex world. $$ \int_{t1}^{t2} x_m(t)x_n^{*}(t)\ dt = \begin{cases} 0 & m \neq n \newline E_n & m = n \end{cases} $$

Where, $x_n^{*}(t)$ is the complex conjugate of, $x_n(t)$. All equations are the same essentially: $$ f(t) = c_1 x_1(t) + c_2 x_2 + \ldots + c_i x_i(t) + \ldots $$

$$ c_n = \dfrac{1}{E_n} \int_{t_1}^{t_2} f(t) x_n^{*}(t)\ dt $$

Trigonometric Fourier series

If the set, is the following: $\{1, cos \omega_0 t, cos 2\omega_0 t, \ldots, cos n\omega_0 t, \ldots ; sin \omega_0 t, sin 2\omega_0 t, \ldots, sin n\omega_0 t, \ldots \}$

This is the orthogonal complete, trigonometric set.

$\omega_0$ is called the fundamental frequency

$n \omega_0$ is called the $n$th harmonic.

We can call the fundamental period for, $T_0$: $$ T_0 = \dfrac{2\pi}{\omega_0} $$

Note that $T_0$ is the fundamental period, meaning it can be at any time instant, as long as it’s a period.

$$ \int_{T_0} cos n\omega_0 t \ cos m\omega_0 t = \begin{cases} 0 & n \neq m \newline \dfrac{T_0}{2} & m = n \neq 0 \end{cases} $$

$$ \int_{T_0} sin n\omega_0 t \ sin m\omega_0 t = \begin{cases} 0 & n \neq m \newline \dfrac{T_0}{2} & m = n \neq 0 \end{cases} $$

$$ \int_{T_0} sin n\omega_0 t \ sin m\omega_0 t = 0 \text{ for all n and m} $$

So: $$ f(t) = a_0 + a_1 cos \omega_0 t + a_2 cos 2\omega_0 t + b_1 sin \omega_0 t + b_2 sin 2\omega_0 t + \ldots $$

So: $$ f(t) = a_0 + \sum_{n = 1}^{\infty} a_n cos n\omega_0 t + b_n sin n\omega_0 t $$

$$ a_n = \dfrac{\int_{t_1}^{t_1 + T_0} f(t)\ cos n\omega_0 t\ dt}{\int_{t_1}^{t_1 + T_0} cos^2 n\omega_0 t\ dt} $$

$$ a_0 = \dfrac{1}{T_0} \int_{t_1}^{t_1 + T_0} f(t)\ dt $$

$$ a_n = \dfrac{2}{T_0} \int_{t_1}^{t_1 + T_0} f(t)\ cos n\omega_0 t\ dt $$

$$ b_n = \dfrac{2}{T_0} \int_{t_1}^{t_1 + T_0} f(t)\ sin n\omega_0 t\ dt $$

We can write this more compactly. $$ a_n cos n\omega_0 t + b_n sin n\omega_0 t = C_n cos(n\omega_0 t + \theta_n) $$

Where: $$ C_n = \sqrt{a_n^2 + b_n^2} $$

$$ \theta_n = tan^{-1} \left(\dfrac{-b_n}{a_n}\right) $$

So: $$ f(t) = C_0 + \sum_{n = 1}^{\infty} C_n cos(n\omega_0 t + \theta_n) $$

Exponential Fourier series

Given the set: $\{e^{jn\omega_0 t}\}$, with, $n = 0, \pm 1, \pm 2, \ldots$, this is complete, orthogonal set.

Note that, $j$ here is complex.

$$ \int_{T_0} e^{jm \omega_0 t} (e^{jn\omega_0 t})^{*}\ dt = \int_{T_0} e^{j(m - n)\omega_0 t}\ dt = \begin{cases} 0 & m \neq n \newline T_0 & m = n \end{cases} $$

$$ f(t) = \sum_{-\infty}^{\infty} D_n e^{jn\omega_0 t} $$

$$ D_n = \dfrac{1}{T_0} \int_{T_0} f(t) e^{-jn\omega_0 t}\ dt $$

Using Euler’s formula, we can switch between trigonometric and exponential series.

$$ C_n cos(n\omega_0 t + \theta_n) = \dfrac{C_n}{2} \left(e^{j(n\omega_0 t + \theta_n)} + e^{-j(n\omega_0 t + \theta_n)}\right) $$

$$ \left(\dfrac{C_n}{2} e^{j\theta_n}\right) e^{jn\omega_0 t} + \left(\dfrac{C_n}{2} e^{-j\theta_n}\right) e^{-jn\omega_0 t} $$

Let’s introduce, $D_n$: $$ D_n = \dfrac{1}{2} C_n e^{j\theta_n} $$

$$ D_{-n} = \dfrac{1}{2} C_n e^{-j\theta_n} $$

$$ f(t) = D_0 + \sum_{n = 1}^{\infty} D_n e^{jn\omega_0 t} + D_{-n} e^{-jn\omega_0 t} $$

In an even more compact form: $$ f(t) = \sum_{-\infty}^{\infty} D_n e^{jn\omega_0 t} $$