Fourier Series Example - A Complicated Function

Again, we want to find the complex Fourier Coefficients
from equation [1] on the complex coefficients page.
However, this time, we can't evaluate the integral
analytically. If you can evalute the integral of equation [1], you should stop studying math, go outside and get some sun.
In general, the Fourier Series coefficients can always be found - although sometimes it is done numerically. On this page,
we'll use f(t) as an example, and numerically (computationally) find the Fourier Series coefficients.
The integral to evaluate the c_n values can be done rather simply. The code I used was done in Matlab, although you could use
pretty much anything (C, Java, python, etc). The code is here, if you want to see it. The first
three coefficients are easily found: c0 = 0.9124, c1 = c(-1) = 3.6935. The first three coefficients, compared to the original f(t)
is shown in Figure 2:
To get an idea of how the coefficients are changing, here is a plot of the magnitude of the c_n, n=1,2,...,30.
The figures shown how rapidly the c_n die off as n increases. The top graph of Figure 4 is the magnitude of the cn,
using a linear scale. The lower graph of Figure 4 is the same plot, but on a log scale, to show the falloff more clearly.

On this page, we'll look at finding the Fourier Series for a complicated function, f(t), shown in Figure 1.
**Figure 1. A Somewhat Complicated Function.***T=2* in this case) is given in Equation [1]:
[Equation 1]
**Figure 2. Original f(t) and the first 3 terms of the Fourier Expansion.****Figure 3. Original f(t) and the first 21 terms of the Fourier Expansion.****Figure 4. Magnitude of Fourier Series Coefficients Versus n. The top graph is using a linear scale; the lower graph uses a log scale of the same function.**

Next: Mean Squared Error (MSE)

Previous: Fourier Series Example - The Saw Function

Fourier Series (Main)

Fourier Transforms (Home)