# Fourier serier

## Solving DE by Fourier series

The Fourier series decomposes periodic or bounded function into simple sinusoids. It is difficult to work with functions as e.g. square waves, sawtooth are and it is easy to work with sines.

### Modal analysis, natural frequencies, vibrations, dynamic behaviour

Fourier series are useful to study resonances of a system. Fourier analysis is able to decompose $f(t)$ into pure oscillations

$$f(t) = b_1\sin \omega_1 t + b_1\sin \omega_2 t + b_1\sin \omega_3 t + \dots \\$$

That is very useful, because then we can analyze which frequencies are main or important within response. We can work with arbitrary periodic function (sine, cosine), solve individually and then recombine to obtain the solution of the original problem (superposition principle).

Natural frequencies characterize the basic behaviour of the system and indicate how the structure will respond to a dynamic loading. There are many reasons to compute the natural frequencies and mode shapes of the structure. For example a rotating machine is to be installed on the floor and it is necessary to determine if the operating frequency of the engine is close to one of the natural frequencies of the building. If the frequencies are too close the consequence might be structural damage or failure.

#### Example

Solve DE describing free undamped motion of spring mass system:

$$my'' + ky = 0\hskip2em y(0) = 0,\ y(T)=0$$

Note: the example is not solved using the Fourier series and serves to review spring-mass system and natural frequency.

We are solving free motion (no external force) of the mass on the spring. The boundary conditions tell us that at $t=0$ and at $t=T$ the mass has to be found in position of equilibrium. If we use natural angular frequency of the system $\boldsymbol{\omega_0=\sqrt{k/m}}$, the same DE can be written as

$$y'' + \omega^2y = 0.$$

Such DE is linear with constant coefficients and can be solved by means of auxiliary equation

$$m^2 + \omega^2 = 0 \implies m = \{ -i \omega ,\ i\omega \}$$

Then the solution is

$$y = C_1e^{-i\omega t} + C_2e^{i\omega t} = c_1 \sin \omega t + c_2 \cos \omega t.$$

Let us use boundary conditions to find $c_1,\ c_2$:

\begin{align} y(t=0) = 0: \hskip2em 0 &= c_1 \sin (\omega \cdot 0) + c_2 \cos (\omega \cdot 0) \implies c_2 = 0 \nonumber \\ y(t=T) = 0: \hskip2em 0 &= c_1 \sin \omega T \nonumber \end{align}

Now if we accept also $c_1 = 0$, we have trivial solution. Such solution is not much useful, because there is no motion described. The mass stays conserved at equilibrium position (does not move). We are looking for nontrivial solution, which comes from the fact that $\sin n\pi$ is zero for each $n = 1,\ 2,\ 3,\ \dots$

$$\omega t = n \pi \implies \omega = \frac{n\pi}{T}$$

In other words we can expres other (nontrivial) solution (regardless the value of $c_1$):

$$y = \sin \left(\frac{n \pi }{T}t\right).$$

The above solution can be listed as a sequence of solutions:

$$y_1 = \sin \frac{\pi t}{T} ,\ y_2 = \sin \frac{2\pi t}{T},\ y_3 = \sin \frac{3\pi t}{T},\ \dots$$

All these solutions are in chord with the complementary function found and at the same time satisfy given boundary conditions. The only issue is that the natural frequency of the system has to fit into given boundary conditions. The half-period of natural frequency has to be $T,\ 2T,\ 3T,\ \dots$ and then the mass passes the requested position once, twice, three times, ... Otherwise the DE has only the trivial solution.

The numbers $\omega_n^2 = {(n^2\pi^2)}/{T^2}$, for which the problem posseses nontrivial solutions, are known as eigenvalues and the nontrivial solutions $y_1,\ y_2\, \dots,\ y_n$ are known as eigenfunctions.

Note: $y''+5y = 0,\ y(0) = 0,\ y(T)=0$ has no trivial solution. The mass is not going to appear back into requested zero position at the requested time $T$, because its natural frequency is not tuned with the time period $T$.

#### Example

Find the particular solution of the spring/mass system $y''+\omega_0^2y = f(t)$, if driving force of period $T=2\ \text{s}$ is

f(t) = \left\{ \begin{aligned} 1&\hskip2em 0\leq t \lt 1, \\ 0&\hskip2em 1\leq t \lt 2. \\ \end{aligned} \right.

and natural frequency of the system is $\omega_0 = 10$.

Firstly, let us discuss why we are finding particular solution $y_p$ and not complementary function $y_c$. The complementary function is a transient solution: self motion with no driving force involved. In general, because of damping, $\lim_{t \to \infty} y_c(t) = 0$. We are rather interested into the particular solution (steady periodic solution), which is the response to the driving force $f(t)$.

Given periodic wave $f(t)$ expressed as a Fourier series is (not solved here)

$$f(t) = \frac 1 2 + \frac 2 {\pi}\sum_{n=1}^{\text{odd}}\frac{\sin nt\pi}{n}.$$

So it is a series of $\sin nt\pi$ where each sine has a coefficient $b_n = 2/(\pi n)$ if $n=1,\ 3,\ 5,\ \dots$ If we can solve this DE with/for one sine, then the same applies to the series of sines. The nonhomogeneous function $f(t)$ on the right side involves sine. According to the method of undetermined coefficients we have to expect particular solution in the form $y_p = A\cos nt\pi + B\sin nt\pi$. But because there is no $y'$ within DE, cosine terms have no origin to come from and can be overlooked:

\begin{align} y_p &= \color{blue}{\sum_{n=1}^{\text{odd}} B_n \sin nt\pi + A} \label{ref:four_ex1} \\ y_p'' &= \color{red}{-\sum_{n=1}^{\text{odd}} B_n n^2\pi^2\sin nt\pi} \nonumber \\ \end{align}

Let us do what we are used to do: substitute $y_p,\ y''_p$ into the DE $\color{red}{y''}+ \color{blue}{\omega_0^2y} = f(t)$.

$$\color{red}{-\sum_{n=1}^{\text{odd}} B_n n^2\pi^2\sin nt\pi} + \color{blue}{\omega_0^2 \sum_{n=1}^{\text{odd}} B_n \sin nt\pi + \omega_0^2 A} = \frac 1 2 + \frac 2 {\pi}\sum_{n=1}^{\text{odd}}\frac{\sin nt\pi}{n}\nonumber \\$$

By method of undetermined coefficients, the coefficient $A$ is easy to solve: $A= 1/2\omega_0^2$. The coefficient $B_n$ can be solved in the same way as there is only $B$ (with no series):

\begin{align} \sum_{n=1}^{\text{odd}}B_n(\color{blue}{\omega_0^2} \color{red}{- n^2\pi^2}) \sin nt\pi &= \frac 2 {\pi} \sum_{n=1}^{\text{odd}}\frac{\sin nt\pi}{n} \nonumber \\ B_n &= \frac 2 {\pi}\cdot \frac{1}{n(\omega_0^2 - n^2\pi^2)} \nonumber \end{align}

The sine series of the solution is determined and let us list a few terms to investigate dominant frequencies.

\begin{align} n=1:&\hskip1em B_1 = \frac{2}{\pi}\frac{1}{1(10^2-1\pi^2)} = 0.007063 \nonumber \\ n=3:&\hskip1em B_3 = \frac{2}{\pi}\frac{1}{3(10^2-3^2\pi^2)} = 0.018992 \nonumber \\ n=5:&\hskip1em B_5 = \frac{2}{\pi}\frac{1}{5(10^2-5^2\pi^2)} = -0.000868 \nonumber \\ n=7:&\hskip1em B_7 = \frac{2}{\pi}\frac{1}{7(10^2-7^2\pi^2)} = -0.000237 \nonumber \\ n=9:&\hskip1em B_9 = \frac{2}{\pi}\frac{1}{9(10^2-9^2\pi^2)} = -0.000101 \nonumber \\ \end{align}

Now the found coefficients can be substituted back into particular solution $(\ref{ref:four_ex1})$.

\begin{align} y_p(t) = \frac{1}{2\omega_0^2} & { } + 0.007063 \sin \pi t + 0.018992 \sin 3\pi t - 0.000868 \sin 5\pi t - \nonumber \\ & { } - 0.000237 \sin 7 \pi t - 0.000101 \sin 9 \pi t - \dots \nonumber \end{align}

The amplitude of $\sin 3\pi t$ (i.e. for $\omega = 3\pi$) is the highest. The system is not going to respond equally to all frequencies but favors frequencies close to its natural frequency.

#### Example

Solve the spring/mass system $\color{red}{y''}\color{green}{+0.05y'}\color{blue}{+10.01y} = f(t)$ if $f(t)$ is periodic function

f(t) = \left\{ \begin{aligned} 1&\hskip2em 0\leq t \lt \pi, \\ -1&\hskip2em \pi\leq t \lt 2\pi. \\ \end{aligned} \right.

From the given DE can be observed that it is a system with damping, where the mass is 1 kg and spring constant is 10.01 N/m. The natural frequency of the system is ${\omega_0=\sqrt{k/m} = \sqrt{10.01/1} = 3.164\ \text{s}^{-1}}$

Given periodic wave $f(t)$ expressed as a Fourier series is (not solved here)

$$f(t) = \frac 4 {\pi}\sum_{n=1}^{\text{odd}}\frac{1}{n}{\sin nt}.$$

So now we have DE with sine on the right side and we are looking for a particular solution $y_p$, which is a response to the driving force $f_t(t)$. We are not going to study complementary function $y_c$, which is only a solution of self motion, which is going—due to the damping—to zero anyway and is only a transient solution.

We have differential equation of the second order with constant coefficients with sine term on the right side. Such DE is easily solved by method of undetermined coefficients: let us collect expected terms $\sin nt$ and $\cos nt$ and then we have to solve constants $A,\ B$:

\begin{align} \color{red}{y_p} &\color{red}{= \sum_{n=1}^{\text{odd}}B_n\sin nt + \sum_{n=1}^{\text{odd}}A_n\cos nt} \label{ref:four_partic1}\\ \color{green}{y_p'} &\color{green}{= \sum_{n=1}^{\text{odd}}B_n\cos nt \cdot n - \sum_{n=1}^{\text{odd}}A_n\sin nt \cdot n}\nonumber \\ \color{blue}{y_p''} &\color{blue}{= -\sum_{n=1}^{\text{odd}}B_n\sin nt\cdot n^2 - \sum_{n=1}^{\text{odd}}A_n\cos nt \cdot n^2}\nonumber \\ \end{align}

Let us substitute $y_p,\ y_p',\ y_p''$ into DE and solve coefficients $A,\ B$ by method of undetermined coefficients as usually:

\begin{align} \color{blue}{- \sum_{n=1}^{\text{odd}}B_n\sin nt\cdot n^2 - \sum_{n=1}^{\text{odd}}A_n\cos nt \cdot n^2} + &\nonumber \\ + \color{green}{0.05 \left(\sum_{n=1}^{\text{odd}}B_n\cos nt \cdot n - \sum_{n=1}^{\text{odd}}A_n\sin nt \cdot n\right)} + &\nonumber \\ + \color{red}{10.01 \left(\sum_{n=1}^{\text{odd}}B_n\sin nt + \sum_{n=1}^{\text{odd}}A_n\cos nt \right)} &= \frac 4 {\pi}\sum_{n=1}^{\text{odd}}\frac{1}{n}{\sin nt} \nonumber \\ \sum_{n=1}^{\text{odd}} \sin nt(-B_nn^2 - 0.05A_nn+10.01B_n) + & \nonumber \\ \sum_{n=1}^{\text{odd}} \cos nt(-A_nn^2 + 0.05B_nn+10.01A_n) &= \frac 4 {\pi}\sum_{n=1}^{\text{odd}}\frac{1}{n}{\sin nt} \nonumber \\ -B_nn^2 - 0.05A_nn + 10.01B_n &= \frac{4}{\pi n} \label{ref:four_ex11} \\ -A_nn^2+0.05 B_nn + 10.01A_n &= 0\label{ref:four_ex12} \end{align}

From $(\ref{ref:four_ex12})$ express $A_n$:

\begin{align} A_n(-n^2+10.01) &= -0.05B_nn \nonumber \\ A_n &= \frac{-0.05B_nn}{10.01-n^2} = \frac{0.05B_nn}{n^2-10.01} \nonumber \\ \end{align}

and substitute into $(\ref{ref:four_ex11})$:

\begin{align} -B_nn^2 -0.05\frac{0.05B_nn}{n^2-10.01} \cdot n + 10.01 B_n &= \frac{4}{\pi n} \nonumber \\ \vdots & \nonumber \\ B_n &= \frac{4(10.01-n^2)}{\pi n\left(0.05^2n^2+(n^2-10.01)^2\right)} \nonumber \\ A_n &= \frac{-0.2}{\pi \left(0.05^2n^2+(n^2-10.01)^2\right)} \nonumber \end{align}

We can form the Fourier series of the response $y_p(t)$ if we use coefficients within $(\ref{ref:four_partic1})$. It is likely to be a messy motion, but this Fourier analysis served to decompose the motion into pure oscillations. The important information can be obtained by studying amplitudes $C_n$ of particular frequencies:

n=1: \hskip2em \left . \begin{aligned} A_1 &= -0.0008 \\ B_1 &= +0.1413 \end{aligned} \right \} \implies C_1 = 0.1413 \\ n=3: \hskip2em \left . \begin{aligned} A_3 &= -0.0611 \\ B_3 &= +0.4111 \end{aligned} \right \} \implies C_3 = 0.4156 \\ n=5: \hskip2em \left . \begin{aligned} A_5 &= -0.0003 \\ B_5 &= -0.0170 \end{aligned} \right \} \implies C_5 = 0.0170 \\ n=7: \hskip2em \left . \begin{aligned} A_7 &= -0.0000 \\ B_7 &= -0.0047 \end{aligned} \right \} \implies C_7 = 0.0047 \\

The first and the second frequencies are the most important. For $n=3$ is $\omega = 3$ and such frequency is close to the natural frequency $\omega_0 = 3.164\ \text{s}^{-1}$ of the system.

Note: since $\cos nt$ is phase delayed $\pi/2 = 90 ^\circ$ after $\sin nt$, there is a right angle between the actual amplitudes of sine and cosine. Therefore, the resultant (maximum amplitude) at particular frequency is $C_n = \sqrt{A_n^2+B_n^2}$.

#### Example

Solve the spring/mass system $2x'' + 18\pi^2x = f(t)$ if $f(t)$ is periodic function

f(t) = \left\{ \begin{aligned} -1&\hskip2em -1\leq t \lt 0, \\ 1&\hskip2em 1\leq t \lt 2. \\ \end{aligned} \right.

From the given DE can be observed that it is a system with no damping, where the mass is likely 2 kg and the natural frequency of the system is $\omega_0=\sqrt{k/m} = \sqrt{18\pi^2/2} = 3\pi$.

From auxiliary equation

\begin{align} m^2+\omega^2 &= 0 \implies m = \pm i\omega \nonumber \\ y_c &= C_1e^{-i\omega x} + C_2e^{i\omega x} \hskip2em \text{or} \nonumber \\ y_c &= c_1\sin\omega x + c_2\cos\omega x \label{ref:Fourier_DE_1} \\ \end{align}

The complementary function was obtained from associated homogeneous DE and describes self motion with no external load involved. Since we are solving induced motion, $y_c$ can be considered as a transient solution only.

Given periodic wave $f(t)$ expressed as a Fourier series is

$$f(t) = \sum_{n=1}^{\text{odd}}\frac 4 {n\pi}{\sin nt\pi}.$$

The function given has half-period $p=1$. The series is odd, so only $b_n \cos \omega_nt$ terms are involved. We do not need to solve $a_n$. If we solve them anyway, they are going to turn to be zero.

\begin{align} b_n&=\frac 1 {p}\int_{-p}^{p}f(t)\sin nt\frac{\pi}{p}\, dt = \frac 2 p \int_0^p \sin nt\pi\ dt = \frac 2 p \left[-\cos nt\pi \frac{1}{n\pi}\right]_0^{p} = \nonumber \\ &= \frac{2}{p} \left(-\frac{1}{n\pi}\right)(\cos np\pi - \cos 0) = -\frac{2}{p}\cdot\frac{1}{n\pi}\left( \cos n\pi-1\right) = -\frac{2}{n\pi}(-2) \nonumber \\ b_n &= \frac{4}{n\pi} \hskip2em \text{for }\ n\ \text{odd} \nonumber\\ \end{align}

If the right side is $4/n\pi\sum\sin nt\pi$ and there is no $x'$ within DE, the particular solution is expected in the form $x_p = B_n\sum\sin nt\pi$ for $n$ odd, no cosine terms involved. The trouble here is that sumation includes also $\boldsymbol{\sin 3t\pi}$ and that term is already part of the complementary function $\boldsymbol{(\ref{ref:Fourier_DE_1})}$ with arbitrary constant $c_1$. As was discussed in chapter Undetermined coefficients—Superposition approach, we have to solve the particular solution for $\color{red}{t}\cdot \sin 3t\pi$ and its derivatives.

The particular solution is then expected as

\begin{align} x_p(t) &= x_{p1}(t) + x_{p_2}(t) \label{ref:Fourier_DE_3} \\ x_{p1}(t) &= \sum_{n=1, n \neq 3}^{\text{odd}} B_n \sin nt\pi \nonumber \\ x_{p2}(t) &= A_3\cos 3t\pi \cdot \color{red}{t} + B_3 \sin 3t\pi \cdot \color{red}{t} \color{grey}{+ C\cos 3t\pi + D\sin 3t\pi} \\ \end{align}

The terms $\cos 3t\pi,\ \sin 3t\pi$ are already included within $y_c$ so they are voided from $x_p$ again.

\begin{align} x_{p1}(t) &= \sum_{n=1, n \neq 3}^{\text{odd}} B_n \sin nt\pi \nonumber \\ x''_{p1}(t) &= - \sum_{n=1, n \neq 3}^{\text{odd}} B_n\sin nt\pi\cdot n^2\pi^2 \nonumber \\ \end{align}

Let us substitute solution $x_{p_1}$ into DE to solve the coefficients.

\begin{align} -2 \sum B_n \sin nt\pi \cdot n^2\pi^2 + 18\pi^2 \sum B_n \sin nt\pi &= \sum \frac 4 {n\pi}\sin nt\pi \nonumber \\ \sum\left( -2B_n n^2\pi^2 + 18\pi^2 B_n\right)\sin nt\pi &= \sum \frac 4 {n\pi} \nonumber \\ -2B_n n^2\pi^2 + 18\pi^2 B_n &= \frac 4 {n\pi} \nonumber \\ B_n(-2n^2\pi^2 + 18\pi^2) &= \frac 4 {n\pi} \nonumber \\ B_n = \frac{4}{-2n^3\pi^3 + 18n\pi^3} &= \frac{2}{n\pi^3(9-n^2)} \nonumber \end{align}
\begin{align} x_{p2}(t) &= A_3\cos 3\pi t\cdot \color{red}{t} + B_3\sin 3\pi t\cdot \color{red}{t} \nonumber \\ x'_{p2}(t) &= A_3\cos 3\pi t- 3\pi A_3 \sin 3\pi t\cdot t + B_3\sin 3\pi t + 3\pi B_3 \cos 3\pi t\cdot t \nonumber \\ x''_{p2}(t) &= -6\pi A_3\sin 3\pi t - 9A_3\pi^2 \cos 3\pi t\cdot t + 6\pi B_3 \cos 3\pi t - 9B_3\pi^2 \sin 3\pi t \cdot t \nonumber \end{align}

Let us substitute $x_{p2}$ into DE $\color{red}{2x''} \color{blue}{+ 18\pi^2x} = f(t)$.

\begin{align} \color{red}{-12\pi A_3\sin 3\pi t - 18 A_3\pi^2 \cos 3\pi t \cdot t + 12\pi B_3 \cos 3\pi t -18 B_3 \pi^2 \sin 3\pi t \cdot t} &+ \nonumber \\ \color{blue}{+ 18\pi^2 A_3 \cos 3\pi t \cdot t + 18 \pi^2 B_3 \sin 3\pi t \cdot t} &= \frac 4 {3\pi}\sin 3\pi t \nonumber \\ -12\pi A_3\sin 3\pi t + 12\pi B_3 \cos 3\pi t &= \frac 4 {3\pi}\sin 3\pi t \nonumber\\ \end{align}

And method of undetermined coefficients gives us

\begin{align} -12\pi A_3 &= \frac 4 {3\pi} \implies A_3 = -\frac{1}{9\pi^2} \nonumber \\ B_3 &= 0 \nonumber \end{align}

Now we can go back to $(\ref{ref:Fourier_DE_3})$ and complete the particular solution.

$$\underline{\underline{x_p(t) = -\frac{1}{9\pi^2} \cos 3\pi t + \sum_{n=1, n \neq 3}^{\text{odd}} \frac{2}{n\pi^3(9-n^2)} \sin nt\pi}}$$

To study resonancy and which frequencies are main when the system is loaded by $f(t)$, we have to evaluate the coefficients:

\begin{align} \omega_{ 1} = \pi:&\hskip2em B_1 = 8.06\times 10^{-3} \nonumber \\ \omega_{ 3} = 3\pi:&\hskip2em A_3 = -11.25\times 10^{-3} \nonumber \\ \omega_{ 5} = 5\pi:&\hskip2em B_5 = -0.81\times 10^{-3} \nonumber \\ \omega_{ 7} = 7\pi:&\hskip2em B_7 = -0.23\times 10^{-3} \nonumber \\ \omega_{ 9} = 9\pi:&\hskip2em B_9 = -0.10\times 10^{-3} \nonumber \\ \omega_{11} = 11\pi:&\hskip2em B_{11} = -0.05\times 10^{-3} \nonumber \\ \end{align}

List of chapters