# A tutorial on Fourier Analysis – Fourier Series

## 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

Here f(x) is the complex periodic function we wish to break down in terms of sine and cosine basis functions. The coefficients a_{0},a_{1},… and b_{1},b_{2},… can be found by

## 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).

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.

## 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.

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.

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.

## 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.

### Example:

Consider the following 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.

## Computing the Fourier Sine Series:

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

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

## 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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
%Author Mathuranathan Viswanathan for http://gaussianwaves.com %Creative Commons CC-BY-NC-SA %If you use this piece of code you must attribute the author clear all;clc; time=linspace(-pi,pi,1000); partial_sum=0; %Complex Function represented in terms of time and amplitude value t=[-pi,-pi,0,0,pi,pi]; value=[0,-1,-1,1,1,-1]; handle1=line(t,value,'color','r','linewidth',2); grid on;hold on; axis([-pi pi -1.5 1.5]) %Since the given complex function exhibits odd periodic extension %only Bn term is valid with n=1,3,5,... for n=1:2:200 %Odd terms to consider for partial sums %Plot 1 period of the given function partial_sum=partial_sum+(4/(n*pi))*sin(n*time); %Fourier Series Expansion using Sine terms error=mean((abs(partial_sum)-1).^2); %Error Criteria handle2=plot(time,partial_sum,'k','linewidth',2); title(['Square Wave Partial Sum: n = ',num2str(n),' Error = ',num2str(error)]) pause set(handle2,'Visible','off'); if error<0.01 break end end |

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