Engineering Analysis/Fourier Series

From Wikibooks, open books for an open world
Jump to: navigation, search

The L2 space is an infinite function space, and therefore a linear combination of any infinite set of orthogonal functions can be used to represent any single member of the L2 space. The decomposition of an L2 function in terms of an infinite basis set is a technique known as the Fourier Decomposition of the function, and produces a result called the Fourier Series.

Fourier Basis[edit]

Let's consider a set of L2 functions, \phi, as follows:

\phi = \{1, \sin(\pi x), \cos(\pi x), \sin(2\pi x), \cos(2\pi x), \sin(3\pi x), \cos(3\pi x) ...\}. \

We can prove that over a range [0, 2\pi], all of these functions are orthogonal:

\int_0^{2\pi} 1 \cdot \cos(n\pi x) dx = 0
\int_0^{2\pi} 1 \cdot \sin(n\pi x) dx = 0
\int_0^{2\pi} \sin(n\pi x) \sin(m\pi x)dx = 0, n \ne m
\int_0^{2\pi} \sin(n\pi x) \cos(m\pi x)dx = 0
\int_0^{2\pi} \cos(n\pi x) \cos(m\pi x)dx = 0, n \ne m

Because \phi is as an infinite orthogonal set in L2, \phi is also a valid basis set in the L2 space. Therefore, we can decompose any function in L2 as the following sum:

[Classical Fourier Series]

\psi(x) = a_0(1) + \sum_{n=1}^\infty a_n \sin(n\pi x) + \sum_{m=1}^\infty b_m\cos(m\pi x)

However, the difficulty occurs when we need to calculate the a and b coefficients. We will show the method to do this below:

a0: The Constant Term[edit]

Calculation of a0 is the easiest, and therefore we will show how to calculate it first. We use the value of a0 which minimizes the error in approximating f(x) by the Fourier series.

First, define an error function, E, that is equal to the squared norm of the difference between the function f(x) and the infinite sum above:

E = \frac{1}{2}\int_0^{2\pi}\|f(x) - a_0(1) - \sum_{n=1}^\infty a_n \sin(n\pi x) - \sum_{m=1}^\infty b_m\cos(m\pi x)\|^2dx

For ease, we will write all the basis functions as the set φ, described above:

\sum_{i=0}^\infty a_i\phi_i = a_0 + \sum_{n=1}^\infty a_n \sin(n\pi x) + \sum_{m=1}^\infty b_m\cos(m\pi x)

Combining the last two functions together, and writing the norm as an integral, we can say:

E = \frac{1}{2}\int_0^{2\pi}|\sum_{i=0}^\infty a_i\phi_i|^2dx

We attempt to minimize this error function with respect to the constant term. To do this, we differentiate both sides with respect to a0, and set the result to zero:

0 = \frac{\partial E}{\partial a_0} = \int_0^{2\pi} (f(x) - \sum_{i=0}^\infty a_i\phi_i(x))(-\phi_0(x))dx

The φ0 term comes out of the sum because of the chain rule: it is the only term in the entire sum dependant on a0. We can separate out the integral above as follows:

\int_0^{2\pi} (f(x) - \sum_{i=0}^\infty a_i\phi_i)(-\phi_0)dx = -\int_0^{2\pi}f(x)\phi_0(x)dx + a_0\int_0^{2\pi}\phi_0(x)\phi_0(x)dx

All the other terms drop out of the infinite sum because they are all orthogonal to φ0. Again, we can rewrite the above equation in terms of the scalar product:

0 = -\langle f(x), \phi_0(x)\rangle + a_0\langle \phi_0(x), \phi_0(x)\rangle

And solving for a0, we get our final result:

a_0 = \frac{\langle f(x), \phi_0(x)\rangle}{\langle \phi_0(x), \phi_0(x)\rangle}

Sin Coefficients[edit]

Using the above method, we can solve for the an coefficients of the sin terms:

a_n = \frac{\langle f(x), \sin(n\pi x)\rangle}{\langle \sin(n\pi x), \sin(n\pi x)\rangle}

Cos Coefficients[edit]

Also using the above method, we can solve for the bn terms of the cos term.

b_n = \frac{\langle f(x), \cos(n\pi x)\rangle}{\langle \cos(n\pi x), \cos(n\pi x)\rangle}