Lecture 25
E12 Linear Physical Systems Analysis
Periodic Functions
Some mathematical functions have the remarkable property of repeating themselves.


Defining what a periodic function is
The formal definition of a periodic function is:
- A function \(f(t)\) is said to be periodic in \(t\) if, for some \(T\), \(f(t+nT) = f(t)\) for all integer \(n\).
- If this is so, the number \(T\) is known as the period of the function \(f\).
- We can describe a periodic function using one of three terms:
- Its period \(T\)
- Its frequency \(f = 1/T\)
- Its angular frequency \(\omega = 2 \pi f = 2 \pi / T\)
- As an example, \(g(t) = \sin 3 t\) is a periodic function because we can find a value of \(T\) that will make the equation \(g(t) = g(t + n T)\) true for all \(T\).
- Task: what is this special value of \(T\)?
- As another example, \(g(t) = \log (t+1)\) is a nonperiodic function because we cannot find any value of \(T\) that will make the equation \(g(t) = g(t + n T)\) true for all \(T\).
Periodic functions made up of multiple sines and cosines.


- Sometimes, a function will ‘contain’ two very different frequencies.
- Often, very high frequencies contribute to the “noise” in a single.
- In this case, we have two functions: \[\sin 3 t + 0.2 \cos 20 t\]
The Fourier theorem (illustration)
Any periodic function can be represented as the sum of sines and cosines.

Mathematical Statement of the Fourier Theorem
A periodic function \(x(t)\) with period \(P\) is equal to the convergent infinite series
\[ \begin{aligned} x(t) &= a_0 + \sum_{n=1}^{\infty} \left( a_n \cos \left( \frac{2 \pi n t}{P} \right) + b_n \sin \left( \frac{2 \pi n t}{P} \right) \right) \\ x(t) &\approx a_0 + \sum_{n=1}^{N} \left( a_n \cos \left( \frac{2 \pi n t}{P} \right) + b_n \sin \left( \frac{2 \pi n t}{P} \right) \right) \end{aligned} \]
for \(a_n\), \(b_n\) given by the Euler Formulas:
\[ \begin{aligned} a_0 &= \frac{1}{P} \int_{-P/2}^{+P/2} x(t) dt \\ a_n &= \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \cos \left( \frac{2 \pi n t}{P} \right) dt \quad n > 0\\ b_n &= \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \sin \left( \frac{2 \pi n t}{P} \right) dt \quad n > 0\\ \end{aligned} \]
Why do we care
That any periodic function can be written as the sum of sines and cosines?

Computing the Fourier Series for small \(N\)
\[x(t) \approx a_0 + \sum_{n=1}^{N} \left( a_n \cos \left( \frac{2 \pi n t}{P} \right) + b_n \sin \left( \frac{2 \pi n t}{P} \right) \right)\]
- If a truly infinite number of terms are added up, i.e., if \(N = \infty\) we have an exact equality between the left and right hand sides.
- What happens when \(N\) is finite? Let’s examine the case when \(N=5\)
- Let \(x(t)\) be given by the following function

Computing the coefficients
\[x(t) \approx a_0 + \sum_{n=1}^{N} \left( a_n \cos \left( \frac{2 \pi n t}{P} \right) + b_n \sin \left( \frac{2 \pi n t}{P} \right) \right)\]

First, we compute the terms \(a_n\) and \(b_n\) for \(N=5\). Using the Euler Formulas, we find the following values
| Term | Value | Term | Value |
|---|---|---|---|
| \(a_0\) | 0 | ||
| \(a_1\) | 0 | \(b_1\) | 1.2732 |
| \(a_2\) | 0 | \(b_2\) | 0 |
| \(a_3\) | 0 | \(b_3\) | 0.4244 |
| \(a_4\) | 0 | \(b_4\) | 0 |
| \(a_5\) | 0 | \(b_5\) | 0.2546 |
The Fourier Theorem tells us that
\[x(t) \approx 1.2732 \sin t + 0.4244 \sin 3t + 0.2546 \sin 5t\]
Visualizing the terms

- Each individual term does not resemble \(x(t)\)
- But their cumulative sum does.
- The terms are simply sine functions with different frequencies.
- The magnitude of each term’s contribution — i.e., the amplitude of each constituent sinusoid — is given by the Euler formulas.
Harmonics and the Fundamental Frequency
- A function with a period of 5 seconds repeats itself every 5 seconds.
- It also repeats itself every \(2 \times 5\) seconds, every \(3 \times 5\) seconds, every \(4 \times 5\) seconds, …
- What is the period of this function?

- If a function \(f(t)\) is periodic, we refer to its smallest period as its fundamental period
- The frequency associated with the fundamental period, i.e., \(f = 1/T\), is known as the fundamental frequency
- If a function \(x(t)\) has fundamental frequency \(f_0\), then its second harmonic is the frequency \(2f_0\), its third harmonic is the frequency \(3 f_0\), and so on.
- Connection to musical notes on Wikipedia
Using Euler’s Formulas to derive Fourier Series approximations of a square wave ‘by hand’
or, it’s not that scary! Start with \(P=2\pi\)
\[ \begin{aligned} x(t) &\approx a_0 + \sum_{n=1}^{N} \left( a_n \cos \left( \frac{2 \pi n t}{P} \right) + b_n \sin \left( \frac{2 \pi n t}{P} \right) \right) \\ a_0 &= \frac{1}{P} \int_{-P/2}^{+P/2} x(t) dt \\ a_n &= \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \cos \left( \frac{2 \pi n t}{P} \right) dt \quad n > 0\\ b_n &= \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \sin \left( \frac{2 \pi n t}{P} \right) dt \quad n > 0\\ \end{aligned} \]
\[ \begin{aligned} x(t) &= \begin{cases} +1 & 0 < t < \pi \\ -1 & -\pi < t < 0 \end{cases} \\ x(t+2\pi \times n) &= x(t) \, \forall n \in \mathbb{N} \end{aligned} \]
Computing \(a_0\)
\(\displaystyle a_0 = \frac{1}{P} \int_{-P/2}^{+P/2} x(t) dt \quad\) where \(P=2\pi\)
Breaking up the integral into two parts, we get
\(\displaystyle = \frac{1}{2\pi} \left( \int_{-\pi}^{0} x(t) dt + \int_{0}^{+\pi} x(t) dt \right)\)
\(\displaystyle = \frac{1}{2\pi} \left( \int_{-\pi}^{0} (-k) dt + \int_{0}^{+\pi} (+k) dt \right)\)
\(\displaystyle = \frac{1}{2\pi} \left( \left[ -kt \right]_{-\pi}^{0} + \left[ kt \right]_{0}^{+\pi} \right)\)
\(\displaystyle = \frac{1}{2\pi} \left( \left[0-(-k\times (-\pi)) \right]+ (k\pi - 0) \right)\)
\(\displaystyle = \frac{1}{2\pi} \left( -k\pi + k\pi \right) = 0\)
- We can also see that \(a_0\) must be zero because the area under the graph of \(x(t)\) is zero when computed from \(-\pi\) to \(+\pi\).
Computing \(a_n\)
\(\displaystyle a_n = \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \cos \left( \frac{2 \pi n t}{P} \right) dt\quad\) where \(P = 2\pi\)
\(\displaystyle = \frac{2}{2\pi} \int_{-\pi}^{+\pi} x(t) \cos \left( \frac{2 \pi n t}{2\pi} \right) dt\) \(\displaystyle = \frac{1}{\pi} \int_{-\pi}^{+\pi} x(t) \cos \left(n t \right) dt\)
Breaking up the integral into two parts and dropping the \((t)\) notation
\(\displaystyle = \frac{1}{\pi} \left( \int_{-\pi}^{0} x \cos n t dt + \int_{0}^{+\pi} x \cos nt dt \right)\)
\(\displaystyle = \frac{1}{\pi} \left( \int_{-\pi}^{0} (-1) \cos n t dt + \int_{0}^{+\pi} (+1) \cos nt dt \right)\)
\(\displaystyle = \frac{1}{\pi} \left( \left[ - \frac{\sin n t}{n} \right]_{-\pi}^{0} + \left[ \frac{\sin n t}{n} \right]_{0}^{+\pi} \right)\)
\(\displaystyle = \frac{1}{n\pi} \left( \left[ - \sin 0 - (- \sin (-n \pi)) \right]+ \left[ \sin n \pi - \sin 0 \right] \right)\)
- Note that \(sin x = 0\) at \(x=0\), \(x=\pi\), and indeed at \(x=n \pi\) for all integer \(n\). So we learn that \(a_n = 0\) for all \(n\).
Computing \(b_n\)
\(\displaystyle b_n = \frac{2}{P} \int_{-P/2}^{+P/2} x(t) \sin \left( \frac{2 \pi n t}{P} \right) dt \quad\) where \(P=2\pi\)
\(\displaystyle = \frac{2}{2\pi} \int_{-\pi}^{+\pi} x(t) \sin \left( \frac{2 \pi n t}{2\pi} \right) dt\) \(\displaystyle = \frac{1}{\pi} \int_{-\pi}^{+\pi} x(t) \sin \left(n t \right) dt\)
Breaking up the integral into two parts and dropping the \((t)\) notation
\(\displaystyle = \frac{1}{\pi} \left( \int_{-\pi}^{0} x \sin n t dt + \int_{0}^{+\pi} x \sin nt dt \right)\)
\(\displaystyle = \frac{1}{\pi} \left( \int_{-\pi}^{0} (-1) \sin n t dt + \int_{0}^{+\pi} (+1) \sin nt dt \right)\)
\(\displaystyle = \frac{1}{\pi} \left( \left[ \frac{1}{n} \cos n t \right]_{-\pi}^{0} + \left[ -\frac{1}{n} \cos n t \right]_{0}^{+\pi} \right)\)
\(\displaystyle = \frac{1}{\pi} \left( \left[ \frac{\cos n t}{n} \right]_{-\pi}^{0} + \left[ - \frac{\cos n t}{n} \right]_{0}^{+\pi} \right)\)
\(\displaystyle = \frac{1}{n\pi} \left( \cos 0 - \cos(-n\pi) + (-\cos n\pi - (-\cos 0)) \right)\)
\(\displaystyle = \frac{1}{n\pi} \left( \cos 0 - \cos(-n\pi) - \cos n\pi +\cos 0) \right)\)
- Using the fact that \(\cos 0 = 1\) and \(\cos (-x) = \cos x\),
\(\displaystyle \implies b_n= \frac{2}{n\pi} \left( 1 - \cos n\pi \right)\)
- Recall that \(\cos n \pi = \begin{cases} -1 & n \text{ odd} \\ +1 & n \text{ even} \end{cases}\)
\(\displaystyle \implies b_n= \frac{2}{n\pi} \left( 1 - \cos n\pi \right) = \begin{cases} \displaystyle \frac{2}{n \pi} \left( 1 - (-1) \right) & n \text{ odd} \\ \displaystyle \frac{2}{n \pi} \left( 1 - (+1) \right) & n \text{ even} \end{cases}\)
\(\displaystyle \implies b_n= \begin{cases} \displaystyle \frac{4}{n \pi} & n \text{ odd} \\ 0 & n \text{ even} \end{cases}\)
The full Fourier Series for a square wave
The Fourier Series representation of the square wave with amplitude 1 and period \(2\pi\), i.e., of the function
\[ \begin{aligned} x(t) &= \begin{cases} +1 & 0 < t < \pi \\ -1 & -\pi < t < 0 \end{cases} \\ x(t+2\pi \times n) &= x(t) \, \forall n \in \mathbb{N} \end{aligned} \]
is therefore
\[x(t) = \sum_{n=1}^{\infty} \left( b_n \sin n t \right), \quad b_n = \begin{cases} \displaystyle \frac{4}{n \pi} & n \text{ odd} \\ 0 & n \text{ even} \end{cases} \tag{1}\]
i.e., \(x\) equals the infinite sum
\[x(t) = \frac{4}{\pi} \left( \frac{1}{1} \sin t + \frac{1}{3} \sin 3 t + \frac{1}{5} \sin 5t + ...\right)\]
where we use the term partial sum up to \(N\) to mean Equation 1 carried out up to \(n = N\).
Even and Odd Functions
We notice that the Fourier Series for the function \(x(t)\) shown here contains only \(\sin\) terms and no \(\cos\) terms.

This is because \(x(t)\) is an odd function.
An odd function \(f(x)\) is a function for which \(\boxed{f(x) = - f(-x)}\) for all \(x\).
Conversely, an even function \(f(x)\) is a function for which \(\boxed{f(x) = f(-x)}\) for all \(x\).
Odd functions have Fourier Series that contain only \(\sin\) terms
Even functions have Fourier Series that contain only \(\cos\) terms
If a function is neither even nor odd, its Fourier Series contains both \(\sin\) and \(\cos\) terms.
Visualizing Even vs odd functionss


Calculating coefficients for another Fourier Series

Show that a mathematical description of the given triangle wave with fundamental period \(2\pi\) is
\[ x(t) = \begin{cases} \displaystyle \frac{t - \pi}{\pi} & -\pi < t < 0 \\ \displaystyle \frac{\pi- t}{\pi} & 0 < t < +\pi \end{cases} \]
Then, show by using piecewise integration of the Euler Formulas that
- \(\displaystyle a_n =\frac{4}{n^2 \pi^2}\) for odd values of \(n>0\),
- \(a_n = 0\) for even values of \(n\)
- \(a_0 = 1/2\).
The infinite Fourier series for this function is
\[x(t) = \frac{4}{\pi^2} \left( \cos t + \frac{\cos 3t}{9} + \frac{\cos 5t}{25} + ...\right)\]
In-class notes

In-class notes

In-class notes

In-class notes

In-class notes

In-class notes

In-class notes
