This should have kept you up all night!
If you read the previous post on the Fourier Series, then you might have noticed that this animation was kind of lying to you.
It surely does seem to resemble a square wave but notice that the peaks in red : They are overshooting and undershooting the maximum and minimum amplitudes.
What on earth is happening here? This goes by the name ‘Gibbs Phenomenon’.
We do not have enough terms
Remember that in Fourier Series you are trying to construct a square wave (which has sharp edges) with smooth and continuous sine and cosine waves.
Fourier series promises us to reconstruct the waveform perfectly ONLY if we provide it with the entire spectrum of frequencies.
But practically we can only work in a finite range of frequencies and when working in a finite domain this overshoot is unavoidable and does not die out.
And if you are an engineer working with a system whose maximum output must not exceed the limit, this can be quite frustrating.
Is there a way out of this ?
Here’s the Fejér summation in action:
Without Fejér summation
Have a good one!
** Read more about the consequences of Gibbs phenomenon here