Professional Documents
Culture Documents
EXPERIMENT NO 10
Ability to Conduct
Experiment
Total Marks:
Obtained Marks:
Data presentation
Experimental results
Conclusion
…………….
Equipment required: •
MATLAB installed on PCs
Background Knowledge:
A Fourier series is a way of representing a periodic function as a sum of sine and cosine functions. It
is a periodic function composed of harmonically related sinusoids, combined by a weighted summation.
With appropriate weights, one cycle of the summation can be made to approximate an arbitrary function in
that interval. Instead of representing the signal amplitude as a function of time, Fourier series represents the
signal by how much information is contained at different frequencies.
Periodic Signals:
where a=0,1,2,3,4…… and T and N are the𝑥(𝑛)fundamental= 𝑥(𝑛 + 𝑎𝑁)time periods in continuous
and discrete
domains. In other words, A periodic signal remains unchanged with a time shift ‘T’. Sinusoidal signals are
the basic example of periodic signals.
Fundamental Period:
The minimum value of T which satisfies is called the fundamental period of the
signal It is the smallest positive value for which𝑥(𝑡)the=equations𝑥(𝑡 + 𝑎𝑇)of periodicity hold. It is
denoted by 𝑇0 for
Harmonics:
The term harmonics is typically applied to repeating signals, such as sinusoidal waves. A harmonic of
a wave is a wave with a frequency that is a positive integer multiple of the frequency of the original wave,
known as the fundamental frequency. The original wave is also called the 1st harmonic, the following
harmonics are known as higher harmonics. higher harmonics for this sinusoid𝑠𝑖𝑛 𝑠𝑖𝑛are 𝑠𝑖𝑛) 𝜔 ) ) etc.
𝑠𝑖𝑛(𝜔 𝑡) is the Consider a sinusoidal signal where is the fundamental frequency of this sinusoid. The
fundamental harmonic while etc. are higher harmonics0 of the fundamental harmonic.
Even and Odd Harmonics:
If the harmonic of a signal has an even co-efficient it is called an even harmonic and if the co-efficient
is odd, it is called an odd harmonic. For example, let 𝑥(𝑡) = 𝑠𝑖𝑛(𝜔0𝑡), then:
-- Odd Harmonics
Fourier Series:
The Fourier series is a representation of a periodic signal in terms of complex exponentials or
sinusoids of frequency multiples of the fundamental frequency𝑥(𝑡)of 𝑥(𝑡). The advantage of using the
Fourier series to represent periodic signals is not only the spectral characterization obtained, but in finding
the response for these signals when applied to LTI systems. Mathematically, the Fourier series is an
expansion of periodic signals in terms of normalized orthogonal complex exponentials.
The complex exponential Fourier series representation of a periodic signal with fundamental
𝑥 𝑘 𝑎𝑘𝑒𝑗𝑘𝑤0𝑡
𝑎𝑘 𝑇 𝑇 𝑒𝑡𝑑𝑡
Trigonometric Fourier series Representation:
is givenTheby:trigonometric Fourier series representation of a periodic signal 𝑥(𝑡) with fundamental period
𝑇0
𝑥 𝑘
𝑎𝑘 𝑡 𝑑𝑡 𝑇
𝑏𝑘𝑇𝑡 𝑑𝑡 𝑇
The complex exponential Fourier series representation of a periodic signal with fundamental
𝑥𝑘 𝑎𝑘𝑒𝑗𝑘𝑤0𝑛
𝑎𝑘 𝑒 𝑛
The trigonometric Fourier series representation of a periodic signal 𝑥[𝑛] with fundamental period 𝑁
is given by: 𝑥 𝑘
where 𝑎𝑘 and 𝑏𝑘 are the Fourier coefficients.
Fourier Spectrum:
Example:
Consider the following function 𝑥(𝑡) where:
Calculate the Fourier series coefficients (𝑎𝑘 , 𝑏𝑘 and 𝑎). Use these coefficients to approximate 𝑥(𝑡).
Theoretical Calculations:
When the given function is extended periodically, its period will be T = 2π. The corresponding
integrals have to be evaluated𝜔 using integration by parts. frequency is therefore = 1. While substituting
this function into appropriate formulas, two of the three
Thus, we get:
This problem can be solved in MATLAB using Symbolic Toolkit. The following code generates the
Fourier coefficients and reconstruct the signal.
Realization of periodic signal decomposition with MATLAB based on Fourier series:
By increasing the number of harmonics, the Fourier series can be used to approximate the original
square wave. The code given below is used to realize the square wave by using its Fourier series
representation.
As more terms are added together the approximation over the flat, continuous part of the square wave
improves. However, the approximation is always poor close to the discontinuity. This is called Gibbs
phenomenon and is caused by approximating a discontinuous function with a finite series of continuous
functions. It is the peculiar manner in which the Fourier series of a piecewise continuously differentiable
periodic function behaves at a jump discontinuity. The nth partial sum of the Fourier series has large
oscillations near the jump, which might increase the maximum of the partial sum above that of the function
itself. The overshoot does not die out as n increases but approaches a finite limit.
Lab Tasks:
1. Consider the given function where:
CODE: 𝑥(𝑡)
clear all
clc tic
syms t
To=2;
wo=2*pi/To;
x=t^2;
k=1:4;
ao=(2/To)*int(x,t,-1,1)
ak=(2/To)*int(x*cos(k*wo*t),t,-1,1)
bk=(2/To)*int(x*sin(k*wo*t),t,-1,1)
a_new=vpa(ak,length(k))
b_new=vpa(bk,length(k))
x_f=ao+ak*cos(k*wo*t)'+bk*sin(k*wo*t)'
x_new=vpa(x_f,length(k))
toc
OUTPUT:
𝑥 𝑘 ∗ 𝜋 𝑘=1
Use MATLAB to plot the results up to = 15, take and t = 0:0.01:5. Increase up to
1000 and see the effect. Explain the effect. 𝑘 𝑤 = 2𝜋 𝑘
CODE:
close all
clear all
clc
tic t=0:0.01:5;
w=2*pi;
s=square(2*pi*t);
k=100; sq_f=0; for i=1:1:k
sq_f=sq_f+(4./(i*pi))*(sin(w*i*t));
plot(t,s,'r')
grid on
hold on
plot(t,sq_f,'b') hold off
title('comparison with square wave');
xlabel('t');
ylabel('function[x(t)]');
end toc
OUTPUT:
graph:
2.
Find the Fourier series for the given triangle wave defined on the interval [-𝜋, 𝜋]
calculations.
CODE:
close all
clear all
clc tic
syms x
To=2;
wo=2*pi/To;
x1=(pi/2)+x;
x2=(pi/2)-x;
k=1:4;
ao=(2/To)*(int(x1,x,-pi,0)+int(x2,x,0,pi))
ak=(2/To)*(int(x1*cos(k*wo*x),x,-
pi,0)+int(x2*cos(k*wo*x),x,0,pi))
bk=(2/To)*(int(x1*sin(k*wo*x),x,-pi,0)+int(x2*sin(k*wo*x),x,0,pi))
a_new=vpa(ak,length(k)) b_new=vpa(bk,length(k))
x_f=ao+ak*cos(k*wo*x)'+bk*sin(k*wo*x)'
x_new=vpa(x_f,length(k)) toc
OUTPUT:
3.
Plot:
calculations.
[Hint: The central segment is 𝑓(𝑥) = 𝑥 𝑓𝑜𝑟 − 𝐿 < 𝑥 < 𝐿 and 𝑓(𝑥) = 𝑥 − 2𝐿 𝑓𝑜𝑟 𝐿 < 𝑥 < 3𝐿 and
CODE:
5.
close all
clear all
clc tic
syms x L=2; To=2*L; wo=2*pi/To; x1=x; x2=x-
2*L; k=-1:10; z1=x*(heaviside(x+1)-
heaviside(x-1)); ao1=(2/To)*(int(x1,x,-L,L))
ak1=(2/To)*(int(x1*cos(k*wo*x),x,-L,L))
bk1=(2/To)*(int(x1*sin(k*wo*x),x,-L,L))
a_new1=vpa(ak1,length(k))
b_new1=vpa(bk1,length(k))
x_f1=ao1+ak1*cos(k*wo*x)'+bk1*sin(k*wo*x)'
x_new1=vpa(x_f1,length(k)); pretty(x_new1);
ezplot(x_new1,[-1,1,-1,1])
hold on
ezplot(z1,[-1,1,-1,1])
hold on grid on
ao2=(2/To)*(int(x2,x,L,3*L))
ak2=(2/To)*(int(x2*cos(k*wo*x),x,L,3*L))
bk2=(2/To)*(int(x2*sin(k*wo*x),x,-L,3*L))
a_new2=vpa(ak2,length(k))
b_new2=vpa(bk2,length(k))
x_f2=ao2+ak2*cos(k*wo*x)'+bk2*sin(k*wo*x)'
x_new2=vpa(x_f2,length(k)); pretty(x_new2);
ezplot(x_new2,[1,3,-1,1])
hold off
grid on
toc
OUTPUT:
6.
7.
graph:
8.
Conclusion:
This lab was about the Fourier series. In this lab, we learned about the Fourier series and
how to find the coefficient of the Fourier series, and also how to plot the Fourier. As the time
period increases the variation between the harmonics becomes similar to that of the original
wave. Fourier series is the periodic signal that contains harmonics this is because it repeats the
signal after its one cycle. A non-periodic signal can never be a Fourier series signal because of
its non-repetition of the same cycle.