A tutorial on Fourier Analysis – Fourier Series

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 5.00 out of 5)

Fourier analysis and Fourier Synthesis:

Fourier analysis – a term named after the French mathematician Joseph Fourier, is the process of breaking down a complex function and expressing it as a combination of simpler functions. The opposite process of combining simpler functions to reconstruct the complex function is termed as Fourier Synthesis.

Mostly, the simpler functions are chosen to be sine and cosine functions. Thus, the term “Fourier analysis” expresses a complex function in terms of sine and cosine terms and the term “Fourier Analysis” reconstructs the complex function from the sine and cosine terms.

Frequency is the measure of number of repetitive occurrences of a particular event. By definition, a sine wave is a smooth curve that repeats at a certain frequency. Thus, the term “frequency” and sine are almost synonymous. A cosine wave is also a sine wave but with 90* phase shift. Therefore, when you talk about sine and cosine functions, you are taking in terms of “frequencies”. That is why in signal processing, the Fourier analysis is applied in frequency (or spectrum) analysis.

Fourier series, Continuous Fourier Transform, Discrete Fourier Transform, and Discrete Time Fourier Transform are some of the variants of Fourier analysis.

Fourier series:

Applied on functions that are periodic. A periodic function is broken down and expressed in terms of sine and cosine terms. In mathematics, the term “series” represents a sum of sequence of numbers. For example we can make a series with a sequence of numbers that follows Geometric Progression (common ratio between the numbers)

Common ratio =3 : 1+3+9+27+…

An infinite series is a series that has infinite number of terms. If the elements of the infinite series has a common ratio less than 1, then there is a possibility of the sum converging at a particular value. Fourier series falls under the category of trigonometric infinite series, where the individual elements of the series are expressed trigonometrically. The construct of the Fourier series is given by

Equation for calculating Fourier Series

Here f(x) is the complex periodic function we wish to break down in terms of sine and cosine basis functions. The coefficients a0,a1,… and b1,b2,… can be found by
Equation for finding Fourier Series Coefficients

Functions and Symmetry:

It is necessary to classify the functions according to its symmetry properties. Doing so will save computation time and effort. Functions either fall into “odd symmetry” or “even symmetry” or “no symmetry”. Symmetry can be ascertained by plotting the function in a graph paper and folding it along the y axis. Symmetry of a function is always with respect to y axis.

Even Symmetry:

Mathematically depicted as f(x) = f(-x). The value of the given function f(x) at a given positive value x is same at corresponding negative value –x.  If plotted on a graph paper and folded along the y-axis, the left half and the right half of the function matches with each other (mirror image).
Even function - Symmetry
For Even Symmetry functions only the cosine terms exists in Fourier Series expansion. The coefficient bn vanishes all-together. This leads to what is called Fourier Cosine Series.

Fourier Cosine Series

Odd Symmetry:

Mathematically depicted as f(x) = -f(-x). The value of the given function f(x) at a given positive value x is same but with a sign change at corresponding negative value –x.  If plotted on a graph paper and folded along the y-axis, the left half of the graph will look like inverted (upside down) mirror image of the right half.

Odd function - Anti-Symmetry
For Odd Symmetry functions only the sine terms exists in Fourier Series expansion. The coefficient an vanishes all-together. This leads to what is called Fourier Sine Series.
Fourier Sine Series
Thus, knowing the symmetry could save us a lots of computation time and effort as we do not have to calculate half the number of coefficients if symmetry exists.

Fourier Series and Function Symmetry

Partial Sum and Convergence of Fourier Series:

Fourier Series is a class of infinite series, meaning that there are infinite terms in the expansion. To decompose a complex function using Fourier Series expansion, one has to limit the number of terms we wish to obtain. We cannot go on calculate the terms indefinitely. Convergence is based on certain criteria. There exists a separate branch of mathematics called “Classical Harmonic Analysis” that deals with this subject. Convergence is usually calculated over a partial sum – the sum of all terms up-to which we have calculated the co-efficients.


Consider the following periodic function :
Odd function - periodic function

Investigation of the function plot reveals that this function exhibits anti-symmetry (odd symmetry). So it is enough if we compute only the sine terms in the Fourier expansion.

Periodic Function exhibiting odd symmetry

Computing the Fourier Sine Series:

Computing Fourier Sine Series

Thus the complete Fourier expansion of the given function f(x) is given by

Fourier Sine Series

Note that the sine term vanishes when n is even (n=0,2,4,…,). Thus the above expansion can be simplified to

Fourier Sine Series computation

Matlab Simulation:

The following Matlab simulation computes the Fourier series expansion of the above mentioned function. The partial sum is plotted till an error criteria is satisfied.

The function f(x) either stays at +1 or at -1. The partial sum is calculated at each step and compared with either +1 or -1 till the error reaches a small value of 0.01.

The plots below shows that the error minimizes as more and more terms are calculated in the series expansion.

Understanding the Plots:

In the first plot, the original square wave (red color) is decomposed into first three terms (n=3) of the Fourier Series. The plot in black color shows how the reconstructed (Fourier Synthesis) signal will look like if the three terms are combined together. As you progress further by increasing the number of terms (n=7,15,55,…) the plot in the black color approximates the original square wave closely.

Note the ringing effect at the corners of the black plot as the number of decomposed terms (n) is increased. This phenomenon is called “Gibbs Phenomenon”. Remember that the Fourier Series is an infinite series with indefinite number of terms. Since we cannot calculate all the infinite number of terms we have to stop at some point. This truncation of the number of decomposed terms leads to Gibbs Phenomenon. Read more on Gibss Phenomenon and its simulation in Matlab here

  • Reema Shrestha

    what if the function is not a square wave and an unknown function? How do we do the expansion?

  • James Hopkins


  • James Hopkins


  • Clement Cole

    how do you change the value of n. I understand its going through a loop with increment of 2 to 200. but its not letting me plot the n values for 3, 5, 7, 15. Its only plotting when n=1

    • In the for loop the value of n starts from 1 and increments by 2. Therefore, the partial sums are calculated for odd values of n (1,3,5,7,..,199).

      The plots shown here are for n=3,7,15,55. I have used a “pause” command in the for loop. The loop pauses for every plot. That is why you are seeing the plot only for value n=1. You need to hit a key on your keyboard or click your mouse, for getting the plots for other values of n.