Day 6 - Fourier Series

fou rier? (im sorry)
01 May 2025

Something to note is that any periodic wave can be broken down into the sum of sine and cosine waves. This serves as the foundation for the Fourier Series.

The general form of a Fourier Series for a function f(x)f(x) defined on the interval [L,L][-L, L] is:

f(x)=a0+n=1ancos(nxπL)+n=1bnsin(nxπL)f(x) = a_0 + \sum_{n=1}^{\infty} a_n \cos\left(\frac{n x \pi}{L}\right) + \sum_{n=1}^{\infty} b_n \sin\left(\frac{n x \pi}{L}\right)

making LL is half the wave period.

a0a_{0} , ana_n and bnb_n are coefficients that we need to find, using these equations respectively.

a0=12LLLf(x)dxa_0 = \frac{1}{2L} \int_{-L}^{L} f(x) \, dx an=1LLLf(x)cos(nπxL)dxa_n = \frac{1}{L} \int_{-L}^{L} f(x) \cos\left(\frac{n\pi x}{L}\right) \, dx bn=1LLLf(x)sin(nπxL)dxb_n = \frac{1}{L} \int_{-L}^{L} f(x) \sin\left(\frac{n\pi x}{L}\right) \, dx

Examples

Lets first look at the square wave.

We start off with sinx\sin x.

Sine Wave

We can then add sin3x3\frac{\sin3x}{3}.

Square 3

We can then keep adding sine waves in the format sin(2n+1)x2n+1\frac{\sin (2n+1)x}{2n+1}.

Square 20

As nn approaches infinity, we eventually get a square wave. (n=20n = 20 in this case.) We can thus use this equation to represent a square wave.

n=0sin((2n+1)x)2n+1\sum_{n=0}^{\infty}\frac{\sin((2n+1)x)}{2n+1}

If we use even coefficients instead, we can get a sawtooth wave using this equation.

n=0sin(2nx)2n\sum_{n=0}^{\infty}\frac{\sin(2nx)}{2n}

Sawtooth 20