S S+Lab+No.+9

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Signals and Systems

(EE-223)

LABORATORY MANUAL

ENGR. Shehzad Ahmad

ENGR. Fakhar Abbas

Finding Fourier Series Coefficients and Reconstruction of


Signal in Continuous Time USING MATLAB

(LAB # 09)
Student Name: ______________________________________________

Roll No: ________________ Section: ____

Date performed: _____________, 2017

MARKS AWARDED: ________ / 10

____________________________________________________________________________________________________________________________________________________________

NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES,


ISLAMABAD

Prepared by: Engr. Aneela Sabir Version: 1.00


Last Edited by:
Verified by: Dr. Mukhtar Ullah Updated: Spring 2016
Finding Fourier Series and Fourier Coefficients using MATLAB Lab 9

Lab # 9: Finding Fourier Series Coefficients and


Reconstruction of Signal in Continuous Time USING
MATLAB

Objective: In this lab, you will learn:


Campute Fourier series coefficients using MATLAB
Plotting the magnitude and phase spectrum of fourier series
how to use laplace to compute fourier coffiecients
how to use fft to compute fourier coffiecients

Tools Used: MATLAB 2015b

Description:

Fourier Series

The Fourier series is a representation of a periodic signal x(t) in terms of complex exponentials
or sinusoids of frequency multiples of the fundamental frequency of x(t). The advantage of
using the Fourier series to represent periodic signals is not only in obtaining their spectral
characterization, but in finding the response of these signals when applied to LTI systems by
means of the eigenfunction property.

Recall that a periodic signal x(t) is such that


it is defined for < t < , i.e., it has an infinite support,
for any integer k, x(t + kT 0) = x(t), where T 0 is the fundamental period of the signal or the
smallest positive real number that makes this possible.

The Fourier Series representation of a periodic signal x(t), of fundamental period T0, is given by
an infinite sum of weighted complex exponentials (cosines and sines) with frequencies multiples
of the fundamental frequency 0 = 2/T0 rad/sec) of the signal:

x(t ) = X k e jk t
0

k=

where the Fourier coefficients {Xk } are found according to

T 0 +t0
1 jk 0 t
Xk =
T0 x (t )e dt
t0

for k = 0,1,2, . . . and any t 0. The form of the last equation indicates that the information
needed for the Fourier series can be obtained from any period of x(t).

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 2 of 5


Finding Fourier Series and Fourier Coefficients using MATLAB Lab 9

MATLAB Code:

Fourier Coefficients using Formula implementation:


Use symbolic MATLAB to compute the Fourier series of y(t) = cos(2ft), find and plot its magnitude and
phase line spectra.

clc; clear all; close all;


syms k t x(t)
f=5;
T= 1/f;
x(t)=cos(2*pi*f*t);
k=-10:1:10;
ck=(1/T)*int(x(t)*exp((-j*2*pi*k*t)/T),t,0,T)
subplot(311)
h=ezplot(x(t),[-2 2]);
set(h,'linewidth',2)
grid;
%Plotting Magnitude and Phase Spectrum
%Defining Frequency axis
freq= k.*1/T;
subplot(312)
stem(freq,abs(ck),'filled');
grid;
axis([-10 10 0 1])
subplot(313)
stem(freq,angle(ck),'filled');
xlim([-10 10])
grid;

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 3 of 5


Finding Fourier Series and Fourier Coefficients using MATLAB Lab 9

Recostruction of orginal signal x(t) using Fourier Coefficients :

We will implement the following formula in Matlab to reconstruct original signal x(t).

x(t ) = Xk e
jk 0 t

k=

where the Fourier coefficients {Xk }.

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 4 of 5


Finding Fourier Series and Fourier Coefficients using MATLAB Lab 9

LAB TASKS;
Question 1:
Write a MATLAB to reconstruct the above sinusoidal signal. Also compare it with orinal signal by showing all
plots oiginal signal, its magnitude and phase line spectra and reconstructed signal.
Question 2:
Consider the periodic pulse train x(t) as shown in the figure, of fundamental period T0 = 1. Find its Fourier
series coefficients and also reconstruct the original signal:

Question 3:
Find Fourier Series coefficients using integral equation and perform reconstruction of the following plot. Also
plot the magnitude line spectra of signal x(t), of fundamental period T0 = 2.

SIGNALS AND SYSTEMS LAB NUCES FAST, ISLAMABAD Page 5 of 5

You might also like