fourier approximation

Mathematics

Approximating a square wave using the Fourier series

Cont’d from “Fourier series

Finally! The long-time-coming Fourier approximation of a square wave, as promised in this post.

Let’s start by considering a rectangular square pulse, which we’ll call the function f(x), and define such that

i.e. a square pulse of width π centred at the origin. We’ll let the periodicity be such that f(x) = f(x + 4π), meaning the function has a period of 4π. Graphically this will be a square wave:

To analyse this using the Fourier series we consider only one square pulse:

First, we’ll evaluate the a0 coefficient, the average of the function. We can find this either by inspecting the graph or mathematically. generally, for a periodic function f(x) centred at the origin with period P, a0 is expressed as

In this case, P = 4π, and so

Now, we shall evaluate the an term. There’s a trick we can use here regarding a function’s odd or even properties:

If the function is even, the an term will contain the integral of an even term so it will contribute the Fourier series. However, the bn term will contain an integral of an odd function, which is zero. Therefore, in this case, we can ignore the bn term:

Conversely, if the function were odd, the an term would contain the integral of an odd function and the bn term would contain the integral of an even function. Hence, only the bn term would contribute and we could ignore the an term.

Now, since the function is symmetric in the y-axis it is even and we should analyse the an coefficient.

Using piecewise analysis we can represent the function as the sum of the individual integrals of each respective parts of the function.

Since sin(−x) = − sin(x),

In turn, it can also be inferred that the integral of an odd function centred at the origin between symmetric limits ±ℓ is twice the integral of the same function between half of those limits. Generally, this is,

Now we can obtain a final value for an. We can express an in terms of the sinc function, defined such that

therefore,

Thus, we can substitute these expressions into the Fourier series.

So what does this function look like? Let’s approximate the function by taking the summation to the 7th term.

Clearly we can see that this is not a completely perfect approximation. As we take it to higher orders, we’d expect the function to look more like the original piece-wise function.

vimeo

A Quantized Confusion Original – Fourier Analysis Compared to Baking!

Different frequencies of waves are like ingredients in a recipe, where “how much” of each ingredient determines what sort of final product you will create.

Whether these ingredients are the stationary states of the quantum harmonic oscillator, or harmonics of an instrument–Fourier Analysis is an infinite concoction of known functions.