0% found this document useful (0 votes)
181 views52 pages

Manual PDF

This document is a lab manual for a Signals and Systems lab course. It provides an overview of the course objectives, outcomes, content, experiments and references. The course aims to help students generate and analyze continuous and discrete time signals and systems using techniques like Fourier series and transforms. The manual describes 12 experiments covering topics like signal generation, operations, periodic signal analysis, Fourier transforms, transfer functions and a course project. It lists reference books and online resources and provides an example experiment on generating and plotting trigonometric functions in MATLAB.

Uploaded by

Chandu mettela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views52 pages

Manual PDF

This document is a lab manual for a Signals and Systems lab course. It provides an overview of the course objectives, outcomes, content, experiments and references. The course aims to help students generate and analyze continuous and discrete time signals and systems using techniques like Fourier series and transforms. The manual describes 12 experiments covering topics like signal generation, operations, periodic signal analysis, Fourier transforms, transfer functions and a course project. It lists reference books and online resources and provides an example experiment on generating and plotting trigonometric functions in MATLAB.

Uploaded by

Chandu mettela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

SIGNALS AND SYSTEMS LAB

LAB MANUAL

Lab Code: 20EC4351


Regulations: VR20
Semester: IV

Prepared
By

G. Hema Kumar
Sr. Assistant Professor

Dr. K. Shri Ramtej


Assistant Professor

Department of Electronics and Communication Engineering


VELAGAPUDI RAMAKRISHNA SIDDHARTHA ENGINEERING COLLEGE
(Sponsored by Siddhartha Academy of General & Technical Education)
Affiliated by JNTUK, Kakinada
VELAGAPUDI RAMAKRISHNA SIDDHARTHA ENGINEERING COLLEGE
(Sponsored by Siddhartha Academy of General & Technical Education)
Affiliated by JNTUK, Kakinada

Department of Electronics and Communication Engineering

Vision
⮚ To produce globally competitive and socially sensitized engineering graduates and to
bring out quality research in the frontier areas of Electronics & Communication
Engineering.

Mission
⮚ To provide quality and contemporary education in the domain of Electronics &
Communication Engineering through periodically updated curriculum, best of breed
laboratory facilities, collaborative ventures with the industries and effective teaching
learning process.
⮚ To pursue research and new technologies in Electronics & Communication
Engineering and related disciplines in order to serve the needs of the society, industry,
government and scientific community.

Programme Educational Objectives


After 3 to 5 years of graduation, ECE graduates will

PEO1. Excel in their professional career and higher education in Electronics and
Communication Engineering and related fields

PEO2. Exhibit leadership through technological ability and contemporary knowledge.

PEO3. Adapt to emerging technologies for sustenance in their relevant areas of


interest.
Program Outcomes (POs)
Engineering knowledge: An ability to apply knowledge of mathematics, science,
PO1 fundamentals of engineering to solve electronics and communication engineering
problems.
Problem analysis: An ability to identify, formulate and analyze electronics and
PO2 communication systems reaching substantiated conclusions using the first principles
of mathematics and engineering sciences.
Design/development of solutions: An ability to design solutions to electronics and
PO3
communication systems to meet the specified needs.
Conduct investigations of complex problems: An ability to design and perform
PO4 experiments of complex electronic circuits and systems, analyze and interpret data to
provide valid conclusions.
Modern tool usage: An ability to learn, select and apply appropriate techniques,
PO5
resources and modern engineering tools for modeling complex engineering systems.
The engineer and society: Knowledge of contemporary issues to assess the societal
PO6
responsibilities relevant to the professional practice.
Environment and sustainability: An ability to understand the impact of professional
PO7 engineering solutions in societal and environmental contexts and demonstrate
knowledge of and need for sustainable development.
Ethics: An understanding of professional and ethical responsibilities and norms of
PO8
engineering practice.
Individual and team work: An ability to function effectively as an individual, and as
PO9
a member in diverse teams and in multidisciplinary settings.
Communication: An ability to communicate effectively with engineering community
PO10
and with society at large.
Project management and finance: An ability to demonstrate knowledge and
PO11 understanding of engineering and management principles and apply these to manage
projects.
Life-long learning: An ability to recognize the need for, and engage in independent
PO12
and life-long learning in the broadest context of technological change.

Program Specific Program Outcomes (PSPOs)

PSO1 Demonstrate proficiency in the use of IOT required in real life applications.

Implement functional blocks of hardware / software designs for signal processing and
PSO2
communication applications.
CODE OF CONDUCT FOR THE LABORATORIES:

1. All students must observe the dress Code while in the laboratory.
2. All bags must be left at the indicated place.
3. The lab timetable must be strictly followed.
4. Be PUNCTUAL for your laboratory session.
5. Workspace must be kept clean and tidy at all time.
6. Handle the systems and equipment with care.
7. All students are liable for any damage to the accessories due to their own negligence.
8. Students are strictly PROHIBITED from taking out any items from the laboratory.
9. Report immediately to the Lab Supervisor if any malfunction of the accessories, is
there.
10. Return the components/meters, turn off the system properly before leaving the lab.
20EC4351: SIGNALS AND SYSTEMS LAB
Course Category: Programme core Credits: 1.5
Course Type: Practical Lab Lecture - Tutorial -Practice: 0-0-3
Prerequisites: 20EC4101:Signals and Continuous Evaluation: 30
Systems Semester end Evaluation: 70
Total Marks: 100

Course Upon successful completion of the course, the student will be able to:
outcomes
CO1 Generate and perform the basic operations on continuous and discrete time
signals

CO2 Analyze the continuous and discrete time signals and systems using Fourier
Series and Fourier Transform
Contribution PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO
of Course 1 2 3 4 5 6 7 8 9 10 11 12 1 2
Outcomes
towards 2 2
achievement CO1 2
of Program
Outcomes
(1 – Low, 2 - CO2 2 2 2
Medium, 3 –
High)
Course Perform the following using simulation software (Matlab/Labview/Scilab)
Content 1. Generation and plotting of Trigonometric and Exponential functions.
2. Generation of standard signals (Impulse, Unit step, Ramp, Sinc functions).
3. Operation on signals (Folding, time shifting, time scaling, amplitude scaling).
4. Generation of periodic and Non-periodic signals.
5. Analysis of Periodic signals using Fourier series.
6. Analysis of Non-periodic signals using Fourier Transform
7. Designing and Simulation of Transfer function.
8. Design of System and analysis by using poles and zeros
9. Verification of Sampling theorem
10. Write a program to find the correlation and convolution of sequences

Course-based Project
11. Implementation of a voiced/unvoiced classifier based on spectral analysis
12. Design of volume control with fade in and fade out

Text books 1. Alan Oppenheim, Signals and Systems, Prentice Hall, 2009.
and Reference 2. Simon Haykin, Signals and Systems, Wiley Publications,2007
books 3. John.G.Proakis, Contemporary Communication Systems, Cengage Learning, 2013.

E-resources 1. https://in.mathworks.com/academia/books/contemporary-communication-systems-
and other using-matlab-proakis.html
digital 2. https://web.stanford.edu/~boyd/ee102/
material 3. https://in.mathworks.com/academia/books/signals-and-systems-using-matlab-
chaparro.html
Experiment 1
Generation and Plotting of Trigonometric and Exponential Functions
Aim: To write a MATLAB Program to generate Trigonometric and Exponential signals
Software Required: MATLAB

Procedure:
● Open MATLAB Software
● Open new M-file
● Type the program
● Save in current directory
● Run the program
● For the output see command window or figure window.

Theory:
The first basic category presented is that of sinusoidal signals. This type of signal is of the
form 𝑥(𝑡) = 𝐴 𝑐𝑜𝑠(𝜔𝑡 + 𝜃), where 𝜔 is the angular frequency, given in 𝑟𝑎𝑑/𝑠, 𝐴 is the
amplitude of the sinusoidal signal, and 𝜃 is the phase (in radians). Sinusoidal signals are
periodic signals with fundamental period 𝑇 given by 𝑇 = 2𝜋/𝜔 𝑠𝑒𝑐. Finally, a useful
quantity is the frequency 𝑓 given in 𝐻𝑒𝑟𝑡𝑧. Frequency is defined by 𝑓 = 1/𝑇 or 𝑓 = 𝜔/2𝜋.

Exponential signals are signals of the form 𝑥(𝑡) = 𝐴𝑒 𝑏𝑡 . If 𝑏 > 0, 𝑥(𝑡) is an


increasing function while if 𝑏 < 0, 𝑥(𝑡) is a decreasing function. At 𝑡 = 0 the signal takes the
value 𝑥(0) = 𝐴 as 𝑒 𝑏𝑡 = 1.

Program: (Trigonometric Function)


% Plot the signal x(t)=3cos(3πt + π/3) in four periods:
clc; % clear command window
clear all; % clear workspace
A=3; % amplitude of the signal
omega=3*pi; % angular frequency
thita=pi/3; % phase
T= 2*pi/omega; % time period
t=0:0.01:4*T; % The time is defined from 0 to 4T
x=A*cos(omega*t+thita); % Signal definition.
y=A*sin(omega*t+thita);
plot(t,x,t,y,'m');
xlabel('Time');
ylabel('Amplitude')
title('Trigonometric Functions')
legend('Cosine','Sine')
Output:

Trigonometric Functions
3
Cosine
Sine
2

1
Amplitude

-1

-2

-3
0 0.5 1 1.5 2 2.5 3
Time

Program: (Exponential Function)


%Plot x(t)=3e0.4t and y(t)=2e-0.9t in the time interval -2 < t <
5.
clc;
clear all;
t=-2:0.01:5;
x=3*exp(0.4*t);
y=2*exp(-0.9*t);
plot(t,x,t,y,'r');
xlabel('Time');
ylabel('Amplitude')
title('Exponential Functions')
legend('Increasing','Decreasing')
Output:

Exponential Functions
25
Increasing
Decreasing

20

15
Amplitude

10

0
-2 -1 0 1 2 3 4 5
Time

Result:

In this experiment trigonometric and exponential signals have been generated using
MATLAB.

Post Lab Questions:

1. Define Sinusoidal Signal.


2. Define continuous time complex exponential signal.
3. Define power and energy signals.
4. Real exponential signal is defined as 𝑥(𝑡) = 𝐴𝑒𝑥𝑝(𝑎𝑡). If the value of 𝑎 is negative,
then what will the signal be? And if the value of 𝑎 is zero, then what will the signal
be?
Experiment 2

Generation of standard signals (Impulse, Unit step, Ramp, Sinc Functions)


Aim: To generate various basic signals like unit impulse, unit step, ramp and sinc functions.

Software Required: MATLAB

Procedure:
● Open MATLAB Software
● Open new M-file
● Type the program
● Save in current directory
● Run the program
● For the output see command window or figure window.

Theory:
In mathematics, the Dirac delta distribution (𝛿 distribution), also known as the unit impulse is
a generalized function, whose value is zero everywhere except at zero, and whose integral
over the entire real line is equal to one.

The Heaviside step function or unit step function is a discontinuous function whose
value is zero for negative arguments and one for positive arguments. It is an example of the
general class of step functions, all of which can be represented as linear combinations of
translations of this one.

The ramp function is a unary real function, whose graph is shaped like a ramp. It can
be expressed by numerous definitions, for example "0 for negative inputs, output equals input
for non-negative inputs".
𝑠𝑖𝑛(𝜋𝑥)
Sinc function is defined as 𝑠𝑖𝑛𝑐(𝑥) = 𝜋𝑥
.
Program:
clc;
clear all;
t=-5:0.01:5;
u=[t>=0]; % unit step
d=[t==0]; % unit impulse
r=t.*u; % ramp function
s=sin(pi*t)./(pi*t); % sinc function
subplot(221)
plot(t,u)
ylim([-0.1 1.1]); % Change axis for better appearance of
graph
xlabel('Time')
ylabel('Amplitude')
title('Unit Step')
subplot(222)
plot(t,d)
ylim([-0.1 1.1]);
xlabel('Time')
ylabel('Amplitude')
title('Unit Impulse')
subplot(223)
plot(t,r)
xlabel('Time')
ylabel('Amplitude')
title('Ramp Function')
subplot(224)
plot(t,s)
xlabel('Time')
ylabel('Amplitude')
title('Sinc Function')
Output:
Unit Step Unit Impulse

1 1

0.8 0.8
Amplitude

Amplitude
0.6 0.6

0.4 0.4

0.2 0.2

0 0
-5 0 5 -5 0 5
Time Time
Ramp Function Sinc Function
5 1

4
0.5
Amplitude

Amplitude

2
0
1

0 -0.5
-5 0 5 -5 0 5
Time Time

Result:
In this experiment various standard signals have been generated using MATLAB.

Post Lab Questions:

1. Define unit step signal and delta function.


2. Define ramp signal and sinc signal.
3. Find the first derivative of continuous time unit step signal.
4. Describe discrete time unit step in terms of unit impulse function.
5. Describe discrete time unit impulse in terms of unit step function.
Experiment 3

Operation on Signals (Folding, Time Shifting, Time Scaling, Amplitude


Scaling)
Aim: To perform various operations on signals like time reversal, shifting, scaling and
amplitude scaling.
Software Required: MATLAB

Procedure:
● Open MATLAB Software
● Open new M-file
● Type the program
● Save in current directory
● Run the program
● For the output see command window or figure window.

Theory:
Time reversal of signal is a very interesting operation applicable on both continuous and
discrete signals. Here in this case the vertical axis acts as the mirror, and the transformed
image obtained is exactly the mirror image of the parent signal. In this operation the signal
𝑥(𝑡) is folded around 𝑡 = 0 to obtain a folded sequence 𝑦(𝑡). It can be defined as 𝑦(𝑡) =
𝑥(−𝑡) where 𝑥(𝑡) is the original signal.
Time shift is given by 𝑦(𝑡) = 𝑥(𝑡 − 𝑡0 ). When the shift constant t0 is positive, the
effect is to move the signal 𝑥(𝑡) to the right by 𝑡0 . In other words, each point on the signal
𝑥(𝑡) now falls t0 later in time, so we call this transformation a time delay. Likewise, when it
is negative, we call it a time advance.
Time scaling is given by 𝑦(𝑡) = 𝑥(𝑎𝑡). When the scaling factor a is greater than 1,
the effect is to “squeeze” the signal toward 𝑡 = 0: an arbitrary point on 𝑥(𝑡) located at, say,
𝑡 = 𝑡1 , namely 𝑥(𝑡1 ), is now moved to the point 𝑡1′ = 𝑡1 /𝑎 on the resulting signal 𝑦(𝑡).
𝑦(𝑡1′ ) = 𝑥(𝑎𝑡1′ ) = 𝑥(𝑎𝑡1 /𝑎) = 𝑥(𝑡1 ). Since 𝑡1′ is closer to the vertical axis than 𝑡1 is, this is
called time compression. When the factor 𝑎 is between 0 and 1, we call it time expansion.
The process of rescaling the amplitude of a signal is known as amplitude scaling. In
the amplitude scaling operation on signals, the shape of the resulting signal remains same as
that of the original signal but the amplitude is altered. The amplitude scaling is given by
𝑦(𝑡) = 𝐴 𝑥(𝑡). Where, 𝐴 is a constant. If 𝐴 > 1, the signal is amplified and if 𝐴 < 1, the
signal is attenuated.
Program:

clc;
clear all;
close all;
t=-2:0.01:2;
x=(0<t&t<=1).*1+(1<t&t<=2).*(2-t);
a=input('Enter the time scaling factor:');
t0=input('Enter the time shift value:');
A=input('Enter the amplitude scaling factor:');
subplot(321)
plot(t,x)
xlabel('Time')
ylabel('Amplitude')
title('Original Signal')
ylim([-0.1 1.1])
subplot(322)
plot(-t,x)
xlabel('Time')
ylabel('Amplitude')
title('Time Reversal')
ylim([-0.1 1.1])
subplot(323)
plot(t/a,x)
xlabel('Time')
ylabel('Amplitude')
title('Time Scaling')
ylim([-0.1 1.1])
subplot(324)
plot(t+t0,x)
xlabel('Time')
ylabel('Amplitude')
title('Time Shifting')
ylim([-0.1 1.1])
subplot(325)
plot(t,A*x)
xlabel('Time')
ylabel('Amplitude')
title('Amplitude Scaling')
ylim([-0.1 1.1])
Output:
Enter the time scaling factor:2
Enter the time shift value:3
Enter the amplitude scaling factor:0.7

Original Signal Time Reversal


1 1
Amplitude

Amplitude
0.5 0.5

0 0
-2 -1 0 1 2 -2 -1 0 1 2
Time Time
Time Scaling Time Shifting
1 1
Amplitude

Amplitude
0.5 0.5

0 0
-1 -0.5 0 0.5 1 1 2 3 4 5
Time Time
Amplitude Scaling
1
Amplitude

0.5

0
-2 -1 0 1 2
Time

Result:

In this experiment various operations on signals have been performed using MATLAB.

Post Lab Questions:

1. What are the basic operations on the signals?


2. Define odd and even signal.
3. Write the expression for the even part of the signal.
4. Write the expression for the odd part of the signal.
5. What will happen if we do time inversion of an odd signal?
Experiment 4

Generation of Periodic and Non-Periodic Signals

Aim: To generate periodic and non-periodic signals using Matlab.

I. Periodic signal generation:


1. Square wave
2. Saw tooth wave
II. Non periodic signal generation:
1. Gate function
2. Signum function

Software Required: MATLAB


Procedure:
 Open MATLAB Software
 Open new Matlab script file
 Type the program
 Save in current directory
 Run the program
 For the output see command window / Figure window.

Theory:
Continuous Time Periodic Signal:
If a signal has a specific pattern and repeats itself at a regular interval of time, it is said to be
periodic. An aperiodic or non-periodic signal, on the other hand, is one that does not repeat at
a regular interval of time.
A cycle is defined as the completion of a full pattern. A period is the length of time
(measured in seconds) it takes to complete one full cycle. The length of a period indicated by
T varies depending on the signal, but it is always the same for any periodic signal. The
frequency of one complete cycle is called fundamental frequency F, and its reciprocal is
called fundamental period, denoted by T.
A continuous time signal 𝑥(𝑡) is said to be periodic if and only if
𝑥(𝑡 + 𝑇) = 𝑥(𝑡) for − ∞ < 𝑡 < ∞
Where, T is a positive constant that represents the time period of the periodic signal.
The smallest value of the time period (T) which justifies the definition of the periodic signal
is known as fundamental time period of the signal and is denoted by (𝑇0). The angular
frequency is given by, 𝜔 = 2𝜋𝑓.
A discrete-time signal x(n) is said to be periodic if it satisfies the following condition
𝑥(𝑛) = 𝑥(𝑛 + 𝑁); for all integers 𝑛
where, N is the time period of the periodic signal and a positive integer. The smallest
value of the time period (N) which satisfies the above condition is known as fundament time
period of the signal. The fundamental time period (N) may be defined as the minimum
number of samples taken by signal to repeat itself. The angular frequency of the discrete time
periodic sequences is given by, 𝜔 = (2𝜋)/𝑁.
The sinusoid, square wave, triangle wave, and saw tooth wave are the most common
periodic signals.

Fig. 1. Continuous time periodic signals

Continuous Time aperiodic Signal / Non-periodic signals:


If a continuous time signal does not have a definite pattern and does not repeat at
regular intervals of time is known as continuous time aperiodic signal or non-periodic signal.
In other words, a signal 𝑥(𝑡) for which no value of time t satisfies the condition of
periodicity, is known as aperiodic or non-periodic signal.

Fig. 2. Continuous tine Non-periodic signals

Gate Function:
The value of the Gate function 𝑥(𝑡) is 0 for |𝑡| > 𝑇/2, and the value of the 𝑥(𝑡) is 𝐴
for |𝑡| < 𝑇/2.
The mathematical expression and graphical representation of Gate function are given
below:

𝐴, |𝑡| ≤ 𝑇/2 1 1
𝑥(𝑡) = { 𝑥(𝑡) = ∏(𝑡) = 𝑢 (𝑡 + 2) − 𝑢 (𝑡 − 2)
0, |𝑡| ≥ 𝑇/2
Signum function:
The signum function simply gives the sign for the given values of x. For x value greater
than zero, the value of the output is +1, for x value lesser than zero, the value of the output is
-1, and for x value equal to zero, the output is equal to zero. The mathematical expression and
graphical representation of signum function given below:
+1, 𝑥>0
𝑠𝑔𝑛(𝑥) = { 0, 𝑥=0
−1, 𝑥<0

Program: (Square wave)

% Program to generate a continuous-time square wave


clc; % clear command window
clear all; % clear workspace
close all; % close figure windows
A = input('Enter the amplitude of the square wave A = ');
f = input('Enter fundamental frequency of square wave F = ');
T = 1/f; % Fundamental period of the square wave;
dc = input('Enter the duty cycle of the square wave DC = ');
t = -10 : 0.001 : 5*T; % time
y = A*square(2*pi*f*t, d);
plot(t ,y )
axis ([-10 50 -4 4])
xlabel('Time in seconds')
ylabel('Amplitude')
title ('Square Wave signal')

Output:
Enter the amplitude of the square wave A = 2
Enter fundamental frequency of square wave F = 0.1
Enter the duty cycle of the wave DC = 50
Square Wave signal
4

1
Amplitude

-1

-2

-3

-4
-10 0 10 20 30 40 50
Time in seconds

Program: (Sawtooth wave)

% Matlab code to generate periodic sawtooth wave


clc; % clear command window
clear all; % clear workspace
close all; % close figure windows

A = input('Enter the amplitude of the sawtooth wave A = ');


f = input('Enter fundamental frequency of sawtooth wave F=');
T = 1/f; % Fundamental period of the sawtooth wave;
w = input('Enter maximum location with in each period W = ');
t = -10 : 0.001 : 5*T; % time
y = A*sawtooth(2*pi*f*t, w);
plot(t ,y, 'm', 'LineWidth',2);
axis ([-10 50 -4 4])
xlabel('Time in seconds', 'FontSize', 18);
ylabel('Amplitude', 'FontSize', 18);
title ('Sawtooth wave signal', 'FontSize', 24);

Output:
Enter the amplitude of the sawtooth wave A = 2
Enter fundamental frequency of sawtooth wave F = 0.1
Enter maximum location with in each period W = 0.5
Sawtooth wave signal
4

2
Amplitude

-1

-2

-3

-4
-10 0 10 20 30 40 50
Time in seconds

Program: (Gate function)

%% Gate function in MATLAB


clc; % clear command window
clear all; % clear workspace
close all; % close figure windows
A = input('Enter the amplitude of the Gate Function A = ');
t= -20 : 0.01 : 20;
x = A*[(t>=-10)&(t<=10)];
figure(1);
plot(t, x, 'm', 'LineWidth', 2);
axis ([-10 50 -4 4])
grid on;
axis([-20 20 -4 4]);
xlabel('Time in seconds', 'FontSize', 18);
ylabel('Amplitude', 'FontSize', 18);
title ('Gate function', 'FontSize', 24);

Output:
Enter the amplitude of the Gate Function A = 2
Gate function
4

2
Amplitude
1

-1

-2

-3

-4
-20 -15 -10 -5 0 5 10 15 20
Time in seconds

Program: (Signum function)

%% Signum function in MATLAB


clc; % clear command window
clear variables; % clear workspace
close all; % close figure windows
t = -50 : 0.01 : 50;
x=[t>0]-[t<0];
figure(1);
plot(t, x, 'm', 'LineWidth', 2);
grid on;
axis([-50 50 -2 2]);
xlabel('Time in seconds', 'FontSize', 18);
ylabel('Amplitude', 'FontSize', 18);
title ('Signum function', 'FontSize', 24);
Output:
Signum function
2

1.5

1
Amplitude

0.5

-0.5

-1

-1.5

-2
-50 -40 -30 -20 -10 0 10 20 30 40 50
Time in seconds

Result:

The periodic and non-periodic signals are generated and plotted for the given amplitude and
fundamental frequency.

Post Lab Questions:

1. Give the mathematical notation that specifies the condition of periodicity for
continuous time signals?
2. What is duty cycle?
3. What is the time period of a periodic signal in actual terms?
4. What is the necessary and sufficient condition for a sum of a periodic continuous time
signal to be periodic?
5. What is the fundamental period of the signal x(t)= ejwt ?
6. The period of the signal x (t) = 10 sin 5t – 4 cos 9t is ?
7. Find the period of x(t) = cos(2t).
8. What is the period of sine signal?
9. Are all sinusoidal signals periodic?
10. Is the sum of two periodic signals is always periodic?
Experiment 5

Analysis of Periodic Signals using Fourier Series

Aim: To analyze periodic signals using Fourier series.

Software Required: MATLAB

Procedure:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window or figure window.

Theory:
Fourier series a way of analyzing/decomposing a continuous-time signal into frequency
components given by sinusoidal signals. This process is crucial in the signal processing field
since it reveals the frequency content of a signal and simplifies the calculation of a system’s
output. With the use of the Fourier series, a signal is expressed in the frequency domain and
sometimes a frequency representation of a signal reveals more information about the signal
than its time domain representation. A signal 𝑥(𝑡) is periodic if 𝑥(𝑡) = 𝑥(𝑡 + 𝑇) for all
values of 𝑡. Any periodic signal, 𝑥(𝑡) can be represented by using complex exponential
Fourier series as

𝑥(𝑡) = ∑ 𝑎𝑘 𝑒 𝑗𝑘𝜔0 𝑡
𝑘=−∞
𝑡0 +𝑇
1
𝑎𝑘 = ∫ 𝑥(𝑡) 𝑒 −𝑗𝑘𝜔0 𝑡
𝑇
𝑡0
Fourier spectrum of a periodic signal 𝑥(𝑡) can be obtained by plotting the Fourier
coefficients with respect to 𝑛. The plot of amplitude of the Fourier coefficients versus 𝑛
is known as amplitude spectrum and the plot of phase of Fourier coefficients verses 𝑛 is
known as phase spectrum. The two plots together are known as frequency spectrum of 𝑥(𝑡).

Plot the magnitude and phase spectrum of 𝒙(𝒕) = 𝒆−𝒕 , 𝟎 ≤ 𝒕 ≤ 𝟑.

Program:

clc;
clear all;
close all;
syms t k
x=exp(-t/2);
T=3;
w=2*pi/T;
a=(1/T)*int(x*exp(-j*k*w*t),t,0,T);
k1=-10:10;
ak=subs(a,k,k1);
subplot(211)
stem(k1,abs(ak));
legend('|a_k|')
subplot(212)
stem(k1,angle(ak));
legend('\angle a_k')

Output:

Magnitude Spectrum
0.8
|ak|
0.6

0.4

0.2

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Phase Spectrum
2
 ak
1

-1

-2
-10 -8 -6 -4 -2 0 2 4 6 8 10

Approximate the signal 𝒙(𝒕) = 𝒆−𝒕 , 𝟎 ≤ 𝒕 ≤ 𝟑 using Fourier series coefficients

Program:

clc;
clear all;
close all;
syms t k
x=exp(-t/2);
T=3;
w=2*pi/T;
for k=-1:1
a(k+2)=(1/T)*int(x*exp(-j*k*w*t),t,0,T);
ex(k+2)=exp(j*k*w*t);
end
xx=sum(a.*ex);
figure(1)
ezplot(x,[0 T])
figure(2)
ezplot(xx, [0 T]);
title('Approximation with 3 terms')
for k=-50:50
a(k+51)=(1/T)*int(x*exp(-j*k*w*t),t,0,T);
ex(k+51)=exp(j*k*w*t);
end
xx=sum(a.*ex);
figure(3)
ezplot(xx, [0 T]);
title('Approximation with 101 terms')

Output:
exp(-t/2)

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0 0.5 1 1.5 2 2.5 3


t

Approximation with 3 terms


0.8

0.7

0.6

0.5

0.4

0.3

0 0.5 1 1.5 2 2.5 3


t
Approximation with 101 terms
1.1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1
0 0.5 1 1.5 2 2.5 3
t

Result:

In this experiment a periodic signal has been approximated by using Fourier series.

Post lab Questions:

1. Name the properties of Fourier series.


2. State the Time shifting and convolution properties.
3. The Fourier series expansion of odd function with half wave symmetry will have only
odd harmonics (True / False)
4. What are the Dirichlet conditions?
5. Write the trigonometric representation of Fourier series of a periodic signal.
Experiment 6
Analysis of Non-Periodic Signals using Fourier Transform
Aim: To write the Matlab code for plotting magnitude and phase spectrum of Fourier
transform for the following functions.
1. Exponential function
2. Gate function
3. Gaussian function
4. Triangular function

Software Required: MATLAB

Procedure:

 Open MATLAB Software


 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window or figure window.

Theory:

A periodic signal defined for −∞ < 𝑡 < ∞ or a signal defined in a closed time interval
𝑎 ≤ 𝑡 ≤ 𝑏 can be expanded in a Fourier series, as a linear combination of infinite
sinusoidal signals. The Fourier series expansion reveals the frequency content of a signal.
The Fourier transform is the way to express any signal defined in the time domain for
−∞ < 𝑡 < ∞ in the frequency domain. The Fourier transform is denoted by the symbol
𝐹{. }; and is defined as

𝑋(𝜔) = 𝐹{𝑥(𝑡)} = ∫ 𝑥(𝑡)𝑒 −𝑗𝜔𝑡 𝑑𝑡


−∞
In order to return from the frequency domain back to the time domain the inverse Fourier
transform is applied. The inverse Fourier transform is denoted by the symbol 𝐹 −1 {. }; and is
defined as

1
𝑥(𝑡) = 𝐹 −1 {𝑋(𝜔)} = ∫ 𝑋(𝜔)𝑒 𝑗𝜔𝑡 𝑑𝑡
2𝜋
−∞

In MATLAB there is the possibility to compute directly the Fourier transform 𝑋(𝜔) of a
signal 𝑥(𝑡) by using the command fourier. Correspondingly, the inverse Fourier transform
is computed by using the command ifourier. Before executing these two commands, time 𝑡
and frequency 𝜔 must be declared as symbolic variables.
𝟏
Exponential Function, 𝒙(𝒕) = 𝒆−𝒕 𝒖(𝒕), 𝑿(𝝎) = 𝟏+𝒋𝝎

Program:
clc;
clear all;
close all;
syms t w;
x=exp(-t)*heaviside(t);
F=fourier(x,w);
simplify(F)
figure(1)
ezplot(x,[-5 5])
ylim([-0.1 1.1])
legend('x(t)')
figure(2)
subplot(211)
ezplot(abs(F),[-5 5])
legend('|X(w)|')
subplot(212)
ezplot(angle(F),[-5 5])
legend('\angle X(w)')

Output:
ans =
1/(w*i + 1)
exp(-t) heaviside(t)

x(t)
1

0.8

0.6

0.4

0.2

-5 -4 -3 -2 -1 0 1 2 3 4 5
t
1/abs(w i + 1)

1
|X(w)|
0.8

0.6

0.4

0.2
-5 -4 -3 -2 -1 0 1 2 3 4 5
w
angle(1/(w i + 1))

 X(w)
1

-1

-5 -4 -3 -2 -1 0 1 2 3 4 5
w

𝟏, |𝒕| < 𝟏
Gate Function, 𝒙(𝒕) = { , 𝑿(𝝎) = 𝟐 𝒔𝒊𝒏𝒄(𝝎)
𝟎, |𝒕| > 𝟏
Program:
clc;
clear all;
close all;
syms t w;
x=heaviside(t+1)-heaviside(t-1);
F=fourier(x,w);
simplify(F)
figure(1)
ezplot(x,[-5 5])
ylim([-0.1 1.1])
legend('x(t)')
figure(2)
subplot(211)
ezplot(abs(F),[-5 5])
legend('|X(w)|')
subplot(212)
ezplot(angle(F),[-10 10])
legend('\angle X(w)')

Output:
ans =
(2*sin(w))/w
heaviside(t + 1) - heaviside(t - 1)

x(t)
1

0.8

0.6

0.4

0.2

-5 -4 -3 -2 -1 0 1 2 3 4 5
t

abs((cos(w) i + sin(w))/w - (cos(w) i - sin(w))/w)

2
|X(w)|
1.5

0.5

0
-5 -4 -3 -2 -1 0 1 2 3 4 5
w
angle((cos(w) i + sin(w))/w - (cos(w) i - sin(w))/w)

3  X(w)

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
w
−𝝎𝟐
−𝒕𝟐
Gaussian Function, 𝒙(𝒕) = 𝒆 , 𝑿(𝝎) = √𝝅 𝒆 𝟒

Program:

clc;
clear all;
close all;
syms t w;
x=exp(-t^2);
F=fourier(x,w);
simplify(F)
figure(1)
ezplot(x,[-5 5])
ylim([-0.1 1.1])
figure(2)
subplot(211)
ezplot(abs(F),[-10 10])
legend('|X(w)|')
subplot(212)
ezplot(angle(F),[-10 10])
legend('\angle X(w)')

Output:
ans =
pi^(1/2)*exp(-w^2/4)
exp(-t2)

0.8

0.6

0.4

0.2

-5 -4 -3 -2 -1 0 1 2 3 4 5
t
1/2 exp(-real(w2)/4)

|X(w)|
1.5

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
w
angle(exp(-w2/4))
1
 X(w)
0.5

-0.5

-1
-10 -8 -6 -4 -2 0 2 4 6 8 10
w

𝟏 + 𝒕, −𝟏 ≤ 𝒕 ≤ 𝟎 𝝎
Triangular Function, 𝒙(𝒕) = { , 𝑿(𝝎) = 𝒔𝒊𝒏𝒄𝟐 ( 𝟐 )
𝟏 − 𝒕, 𝟎 ≤ 𝒕 ≤ 𝟏

Program:
clc;
clear all;
close all;
syms t w;
x=(t+1)*(heaviside(t+1)- heaviside(t))+(1-t)*(heaviside(t)-
heaviside(t-1));
F=fourier(x,w);
simplify(F)
F=int(x*exp(-j*w*t),t,-inf,inf)
figure(1)
ezplot(x,[-3 3])
legend('x(t)')
figure(2)
subplot(211)
ezplot(abs(F),[-20 20])
legend('|X(w)|')
subplot(212)
ezplot(angle(F),[-20 20])
legend('\angle X(w)')

Output:
ans =
-(2*cos(w) - 2)/w^2
F =
-(2*cos(w) - 2)/w^2
(t - 1) (heaviside(t - 1) - heaviside(t)) + (t + 1) (heaviside(t + 1) - heaviside(t))

1 x(t)

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

-3 -2 -1 0 1 2 3
t

abs(2 cos(w) - 2)/abs(w)2


1
|X(w)|

0.5

0
-20 -15 -10 -5 0 5 10 15 20
w
angle(-(2 cos(w) - 2)/w2)
1
 X(w)
0.5

-0.5

-1
-20 -15 -10 -5 0 5 10 15 20
w
Result:
In this experiment magnitude and phase spectrum of some functions have been plotted by
using Fourier transform.

Post Lab Questions:


1. What is the Inverse Fourier transform of 'l'?
2. What is the fourier transform of Impulse Signal?
3. What is the fourier transform of Step Signal?
4. What is the fourier transform of Signum signal?
5. Whats is the Inverse Fourier transform of 𝑈(𝜔)?
Experiment 7

Designing and Simulation of Transfer Function

Aim: To plot the frequency spectrum of the following transfer functions.


2𝑆+5
a) 𝐻(𝑆) = (𝑆+2)(𝑆+3)
2𝑆+4
b) 𝐻(𝑆) = (𝑠2 +4𝑆+3)
1
c) 𝐻(𝑆) = (𝑆−1)(𝑆+2)

Software Required: MATLAB

Procedure:
● Open MATLAB Software
● Open new M-file
● Type the program
● Save in current directory
● Run the program
● For the output see command window or figure window.

Theory:
The transfer function of an LTI system is defined as the ratio of the Laplace transform
𝑌(𝑠) of the output signal 𝑦(𝑡) to the Laplace transform 𝑋(𝑠) of the input signal 𝑥(𝑡),
supposing zero initial conditions.
𝑦(𝑡) = ℎ(𝑡) ∗ 𝑥(𝑡)
Applying Laplace transform to both sides and considering the convolution property of
Laplace transform yields
𝑌(𝑠) = 𝑋(𝑠)𝐻(𝑠)
Where 𝐻(𝑠) is the transfer function. A transfer function is usually given in rational
form, written as a ratio of two polynomials.

𝑌(𝑠) 𝑏𝑚 𝑠 𝑚 + 𝑏𝑚−1 𝑠 𝑚−1 + ⋯ + 𝑏0


𝐻(𝑠) = =
𝑋(𝑠) 𝑎𝑚 𝑠 𝑚 + 𝑎𝑚−1 𝑠 𝑚−1 + ⋯ + 𝑎0

In order to define a transfer function in MATLAB we can use the command tf. The
syntax is H=tf(num, den), where num and den are vectors containing the polynomial
coefficients of the numerator and denominator, respectively. The outcome H is a special type
of MATLAB variable named TF object, and represents the transfer function of a system.

If the system is stable, the frequency response 𝐻(𝑗𝜔) of the system is computed by
substituting 𝑠 by 𝑗𝜔 in 𝐻(𝑠). In order to numerically compute 𝐻(𝑗𝜔) over a frequency range
𝜔1 < 𝜔 < 𝜔2 rad/s from the system transfer function 𝐻(𝑠), one can use the command
freqresp. Its syntax is Hw=freqresp(Hs,w), where Hs denotes the transfer function
𝐻(𝑠) of the system, w is the vector containing the frequencies, and Hw is the frequency
response of the system evaluated at the frequencies specified in vector w. However, the
output argument Hw is a 3-D matrix. In the simple case of a SISO system, the value of the
frequency response for a specific frequency is contained in the third dimension of the 3-D
matrix Hw. Hence, in order to plot the magnitude of the computed frequency response the
appropriate statement is plot(w,angle(Hw(:,:)), and correspondingly the graph of
the phase is derived with the statement plot(w,angle(Hw(:,:))).
𝟐𝒔+𝟓
Program: 𝑯(𝒔) = (𝒔+𝟐)(𝒔+𝟑)

clc;
close all;
clear all;
syms s t
num=[2 5];
den=poly([-2 -3]);
Hs=tf(num,den)
w=-10:.1:10;
Hw=freqresp(Hs,w);
subplot(211)
plot(w,abs(Hw(:,:)));
legend('|H(w)|');
grid on;
subplot(212)
plot(w,angle(Hw(:,:)))
legend('\angle H(w)');
grid on;

Output:
H=

2s+5
-------------
s^2 + 5 s + 6

Continuous-time transfer function.


1
|H(w)|
0.8

0.6

0.4

0.2

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

2
 H(w)
1

-1

-2
-10 -8 -6 -4 -2 0 2 4 6 8 10

𝟐𝒔+𝟒
Program: 𝑯(𝒔) = (𝒔𝟐 +𝟒𝒔+𝟑)

clc;
close all;
clear all;
syms s t
num=[2 4];
den=[1 4 3];
Hs=tf(num, den)
w=-10:.1:10;
Hw=freqresp(Hs,w);
subplot(211)
plot(w,abs(Hw(:,:)));
legend('|H(w)|');
grid on;
subplot(212)
plot(w,angle(Hw(:,:)))
legend('\angle H(w)');
grid on;

Output:

H=

2s+4
-------------
s^2 + 4 s + 3

Continuous-time transfer function.


1.5
|H(w)|

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

2
 H(w)
1

-1

-2
-10 -8 -6 -4 -2 0 2 4 6 8 10

𝟏
Program: 𝑯(𝒔) =
(𝒔−𝟏)(𝒔+𝟐)

clc;
close all;
clear all;
syms s t
num=[1];
den=poly([1 -2]);
Hs=tf(num, den)
w=-10:.1:10;
Hw=freqresp(Hs,w);
subplot(211)
plot(w,abs(Hw(:,:)));
legend('|H(w)|');
grid on;
subplot(212)
plot(w,angle(Hw(:,:)))
legend('\angle H(w)');
grid on;

Output:
H=

-----------

s^2 + s - 2
Continuous-time transfer function.

0.5
|H(w)|
0.4

0.3

0.2

0.1

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

4
 H(w)
2

-2

-4
-10 -8 -6 -4 -2 0 2 4 6 8 10

Result:

In this experiment frequency spectrum of given transfer function is plotted using MATLAB.

Post Lab Questions:

1. Define Transfer Function.


2. What is Frequency Response?
3. What are poles and Zeros?
4. What is ROC?
5. Define Stability.
Experiment 8
Design of System and Analysis by using Poles and Zeros
Aim: a) To verify linearity and time invariance properties of a given system.

Software Required: MATLAB

Procedure:
 Open MATLAB Software
 Open new Matlab script file
 Type the program
 Save in current directory
 Run the program
 For the output see command window / Figure window.

Theory:

Let 𝑦(𝑡) denote the response of a system 𝑇 to an input signal 𝑥(𝑡), that is,
𝑦(𝑡) = 𝑇{ 𝑥(𝑡)}. System T is linear if for any input signals 𝑥1 (𝑡) and 𝑥2 (𝑡) and any scalars
𝑎1 and 𝑎1 the following relationship holds:

𝑇{𝑎1 𝑥1 (𝑡) + 𝑎2 𝑥2 (𝑡) } = 𝑎1 𝑇{𝑥1 (𝑡)} + 𝑎2 𝑇{𝑥2 (𝑡)}

In other words, the response of a linear system to an input that is a linear combination of two
signals is the linear combination of the responses of the system to each one of these signals.
The linearity property is generalized for any number of input signals, and this is often
referred to as the principle of superposition.

A system is time invariant, if a time shift in the input signal results in the same time shift in
the output signal. In other words, if 𝑦(𝑡) is the response of a time-invariant system to an input
signal 𝑥(𝑡), then the system response to the input signal 𝑥(𝑡 − 𝑡0 ) is 𝑦(𝑡 − 𝑡0 ). The
mathematical expression is

𝑦(𝑡 − 𝑡0 ) = 𝑇{ 𝑥(𝑡 − 𝑡0 )}

Equivalently, a discrete-time system is time invariant if 𝑦(𝑛 − 𝑛0 ) = 𝑇{ 𝑥(𝑛 − 𝑛0 )}

Program: (To verify linearity of a system)

clc;
clear all;
close all;
t=-2:0.01:2;
a=2;
b=3;
w=2;
x1=5*cos(w*t);
y1=x1.*cos(4*w*t); %y(t)=x(t)cos(4wt)
x2=6*sin(w*t);
y2=x2.*cos(4*w*t);
x3=a*x1+b*x2;
y=x3.*cos(4*w*t);
z=a*y1+b*y2;
if (round(z)==round(y))
disp('The System is Linear');
else
disp('The System is non linear');
end;
subplot(4,2,1);
plot(t,x1);
title('x_1 function');
subplot(4,2,2);
plot(t,y1);
title('y_1 function');
subplot(4,2,3);
plot(t,x2);
title('x_2 function');
subplot(4,2,4);
plot(t,y2);
title('y_2 function');
subplot(4,2,5);
plot(t,x3);
title('x_3=ax_1+bx_2 function');
subplot(4,2,6);
plot(t,y);
title('Output due to sum of weighted inputs - (ax_1+bx_2)');
subplot(4,2,7);
plot(t,z);
title('Sum of Weighted outputs – ay_1+by_2 ');

Output:

The System is Linear


x 1 function y 1 function
5 5
0 0
-5 -5
-2 -1 0 1 2 -2 -1 0 1 2
x 2 function y 2 function
10 10
0 0
-10 -10
-2 -1 0 1 2 -2 -1 0 1 2
x 3=ax 1+bx 2 function Output due to sum of weighted inputs - (ax 1+bx 2)
50 20
0 0
-50 -20
-2 -1 0 1 2 -2 -1 0 1 2
Sum of Weighted outputs – ay 1+by 2
20
0
-20
-2 -1 0 1 2

Program: (Time Invariance)

clc;
clear all;
close all;
n=-4:4; %Length of the input signal
x=cos(n); % Input signal
y=n.*x; %y(n)=n*x(n)
xd=cos(n-3); % Input signal delayed by 3
ydi=n.*xd; % Output due to delayed input signal xd
ydo=(n-3).*xd; % Delayed Output
d=ydi-ydo; % Difference between y(t,d) and y(t-d)
if (d==0)
disp('Given system is Time invariant');
else
disp('Given system is NOT Time invariant');
end
subplot(3,2,1);
stem(n,x);
title('Input signal');
subplot(3,2,2);
stem(n,y);
title('Output signal');
subplot(3,2,3);
stem(n,xd);
title('Delayed input');
subplot(3,2,4);
stem(n,ydi);
title('Output due to Delayed input');
subplot(3,2,5);
stem(n,ydo);
title('Delayed output signal');
subplot(3,2,6);
stem(n,d);
title({'Difference between delayed output' ,'and output due to
delayed input'});
Output:

Given system is NOT Time invariant

Input signal Output signal


1 5

0 0

-1 -5
-4 -2 0 2 4 -4 -2 0 2 4

Delayed input Output due to Delayed input


1 5

0 0

-1 -5
-4 -2 0 2 4 -4 -2 0 2 4
Difference between delayed output
Delayed output signal and output due to delayed input
10 5

0 0

-10 -5
-4 -2 0 2 4 -4 -2 0 2 4

Result:

In this experiment Linearity and Time invariance properties of given system has been
verified using MATLAB.

Post Lab Questions:

1. Define Continuous-time system and Discrete-time system.


2. What is the classification of the system?
3. Define a causal system.
4. Define static and dynamic systems.
5. Is the system 𝑦(𝑡) = 𝑦(𝑡 – 1) + 2𝑡 𝑦(𝑡 – 2) time-invariant?
Aim: b) Locating the zeros and poles and plotting the pole-zero maps in S-plane and Z-plane
for the given transfer function.

Software Required: MATLAB

Procedure:

● Open MATLAB Software


● Open new M-file
● Type the program
● Save in current directory
● Run the program
● For the output see command window\ Figure window.

Theory:
Z-transform:
The Z-transform converts a discrete time-domain signal, which is a sequence of real or
complex numbers, into a complex frequency-domain representation. The Z-transform, like
many other integral transforms, can be defined as either a one-sided or two-sided transform.

Bilateral Z-transform
The bilateral or two-sided Z-transform of a discrete-time signal 𝑥[𝑛] is the function 𝑋(𝑧)
defined as

𝑋(𝑧) = 𝑍{𝑥[𝑛]} = ∑  𝑥[𝑛]𝑧 −𝑛


𝑛=−∞

Unilateral Z-transform
Alternatively, in cases where 𝑥[𝑛] is defined only for 𝑛 ≥ 0, the single-sided or
unilateral Z-transform is defined as
𝑋(𝑧) = 𝑍{𝑥[𝑛]} = ∑∞
𝑛=0  𝑥 [𝑛]𝑧
−𝑛
, 𝑤ℎ𝑒𝑟𝑒 𝑧 = 𝑟 ⋅ 𝑒 𝑗𝜔

In signal processing, this definition is used when the signal is causal.

The roots of the equation 𝑃(𝑧) = 0 correspond to the 'zeros' of 𝑋(𝑧)

𝑃(𝑧)
𝑋(𝑧) =
𝑄(𝑧)

The roots of the equation 𝑄(𝑧) = 0 correspond to the 'poles' of 𝑋(𝑧)


Program:
clc;
clear all;
close all;
num = input('Enter the Numerator Coefficients');
den = input('Enter the Denominator Coefficients');
H = tf(num, den)
poles = roots(den);
disp('Poles of Transfer Function');
disp(poles);
zeros = roots(num);
disp('Zeros of Transfer Function');
disp(zeros);
figure(1)
pzmap(H);
grid on
title('Pole/Zero Plot in S plane');
figure(2)
zplane(zeros,poles);
title('Pole/Zero Plot in Z plane');

Output:
Enter the Numerator Coefficients [1 2 3 4]
Enter the Denominator Coefficients [1 4 5 6]

H=

s^3 + 2 s^2 + 3 s + 4
---------------------
s^3 + 4 s^2 + 5 s + 6

Continuous-time transfer function.

Poles of Transfer Function


-3.0000 + 0.0000i
-0.5000 + 1.3229i
-0.5000 - 1.3229i
Zeros of Transfer Function
-1.6506 + 0.0000i
-0.1747 + 1.5469i
-0.1747 - 1.5469i
Pole/Zero Plot in S plane
2
0.84 0.72 0.58 0.44 0.3 0.14

1.5 0.92

1
Imaginary Axis (seconds-1)

0.98
0.5

3.5 3 2.5 2 1.5 1 0.5


0

-0.5
0.98

-1

-1.5 0.92

0.84 0.72 0.58 0.44 0.3 0.14


-2
-3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis (seconds -1)

Pole/Zero Plot in Z plane

1.5

0.5
Imaginary Part

-0.5

-1

-1.5

-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1


Real Part

Result:
In this experiment the poles and zeros are located and plotted in s-plane and z-plane for the
given transfer function using MATLAB.
Post Lab Questions:
1. Define Stability?
2. What are poles and zeros?
3. What is invertible system?
4. What is ITR and FIR system?
5. What do you mean by BIBO condition?
Experiment-9

Verification of Sampling Theorem

Aim: To verify Sampling Theorem


Software Required: MATLAB
Procedure:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window\ Figure window.

Theory:
Sampling is the process of converting a continuous time signal 𝑔(𝑡) into a discrete time
signal 𝑔(𝑛) by measuring the amplitudes of continuous time signal 𝑔(𝑡) at integer
multiples of a sampling interval 𝑇𝑠 .

Sampling theorem states that a band limited signal can be reconstructed exactly
if it is sampled at a rate at least twice the maximum frequency component in it. Figure
shows a signal 𝑔(𝑡) that is band limited to 𝜔𝑚 .

The maximum frequency component of 𝑔(𝑡) is 𝑓𝑚 . To recover the signal 𝑔(𝑡) exactly
from its samples it has to be sampled at a rate 𝑓𝑠 ≥ 2𝑓𝑚 . The minimum required sampling
rate 𝑓𝑠 = 2𝑓𝑚 is called ' Nyquist rate and 𝑇𝑠 = 1/2𝑓𝑚 is called Nyquist interval.
Program:
clc;
clear all;
close all;
% Signal Parameters
fm = 10; % Signal Frequency = 10Hz
T = 1/fm; % Signal Period
t = 0:0.01*T:2*T; % Time index
% Generate the original signal and plot it:
x = cos(2*pi*fm*t); % Signal : 2*pi*f*t
subplot(2,2,1);
plot(t,x);
title('Continuous signal');
xlabel('t');
ylabel('x(t)');
%Oversampling Condition:
fs1 = 10*fm; % Oversampling (fs > 2fm)
n1 = 0:1/fs1:2*T; % Time scale (nTs)
x1 = cos(2*pi*fm*n1); % Generating sampled signal
subplot(2,2,2);
stem(n1,x1);
hold on;
plot(n1,x1,'r');
title('Oversampling Condition: f_s = 10f_m');
xlabel('n');
ylabel('x(n)');
% Right Sampling Condition:
fs2 = 2*fm; % Nyquist Rate Sampling (fs = 2fm)
n2 = 0:1/fs2:2*T; % Time scale (nTs)
x2 = cos(2*pi*fm*n2);
subplot(2,2,3);
stem(n2,x2);
hold on;
plot(n2,x2,'r');
title('Sampling at Nyquist Frequency: f_s = 2f_m');
xlabel('n');
ylabel('x(n)');
% Under Sampling Condition:
fs3 = 1.5*fm; % Undersampling (fs < 2fm)
n3 = 0:1/fs3:2*T; % Time scale (nTs)
x3 = cos(2*pi*fm*n3);
subplot(2,2,4);
stem(n3,x3);
hold on;
plot(n3,x3,'r');
title('Undersampling Condition: f_s = 1.5f_m');
xlabel('n');
ylabel('x(n)');
legend('Sampled Signal','Recovered Signal')
Output:

Continuous signal Oversampling Condition: fs = 10fm


1 1

0.5 0.5

x(n)
x(t)

0 0

-0.5 -0.5

-1 -1
0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2
t n
Sampling at Nyquist Frequency: fs = 2fm Undersampling Condition: fs = 1.5fm
1 1
Sampled Signal
0.5 0.5 Recovered Signal
x(n)

x(n)

0 0

-0.5 -0.5

-1 -1
0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2
n n

Result:

In this experiment the sampling theorem has been verified by using MATLAB.

Post Lab Questions:


1. State Sampling Theorem.
2. What is meant by aliasing? How to eliminate aliasing effect?
3. Define Nyquist Interval and Nyquist Rate.
4. What do you mean by sampling period and sampling frequency?
5. What is the sampling frequency used for sampling of speech signal?
Experiment-10

Correlation and Convolution of Sequences

Aim: To perform correlation and convolution between two sequences.

Software Required: MATLAB

Procedure:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window or figure window.

Theory:

Convolution of two discrete sequences 𝑥(𝑛) and ℎ(𝑛) is defined as

𝑦(𝑛) = 𝑥(𝑛) ∗ ℎ(𝑛) = ∑   𝑥(𝑘)ℎ(𝑛 − 𝑘)


𝑘=−∞

If length of the sequence 𝑥(𝑛) is 𝑁 and length of the sequence ℎ(𝑛) is 𝑀, then 𝑦(𝑛)
will have a length of 𝑀 + 𝑁 − 1. If the nonzero values of 𝑥(𝑛) are in the interval [𝑎𝑥 , 𝑏𝑥 ]
and the nonzero values of ℎ(𝑛) are in the interval [𝑎ℎ , 𝑏ℎ ] then the nonzero values of the
output 𝑦(𝑛) are in the interval [𝑎𝑥 + 𝑎ℎ , 𝑏𝑥 + 𝑏ℎ ]
The cross correlation function between two different signals is defined as the measure
of similarity between one signal and the time delayed version of another signal. The cross
correlation between two sequences 𝑥(𝑛) and 𝑦(𝑛) is given by

𝑟𝑥𝑦 (𝑙) = ∑ 𝑥(𝑛)𝑦(𝑛 − 𝑙)


𝑛=−∞

The auto correlation of a sequence is correlation of a sequence with itself. The auto
correlation of sequence 𝑥(𝑛) is defined as

𝑟𝑥𝑥 (𝑙) = ∑ 𝑥(𝑛)𝑥(𝑛 − 𝑙)


𝑛=−∞

If length of the sequence 𝑥(𝑛) is 𝑁 and length of the sequence 𝑦(𝑛) is 𝑀, then 𝑟𝑥𝑦 (𝑙) will
have a length of 2 × 𝑀𝑎𝑥(𝑀, 𝑁) − 1.
Program:

clc;
close all;
clear all;
x = input('Enter Input Sequence for Signal x(n): ');
h = input('Enter Input Sequence for Signal h(n): ');
[c,lags] = xcorr(x,h); %Performing correlation
y=conv(x,h); %Performing Convolution using conv command
disp('Convolved sequence using matlab function:');
disp(y);
n1=length(x);
n2=length(h);
N = n1+n2-1; %Length of Convolved Sequence
%Zero padding to make sequences of length N
x=[x zeros(1,N-n1)];
h=[h zeros(1,N-n2)];
%Initializing the output with zeros
y = zeros(1,N);
%Performing Convolution using formula
for n = 1:N
for k = 1:n
y(n)=y(n)+x(k)*h(n-k+1);
end
end
disp('Convolved sequence using convolution sum formula:');
disp(y);
subplot(2,2,1);
stem(0:N-1,x);
title('Input Sequence x(n)');
xlabel('n');
ylabel('x(n)');
subplot(2,2,2);
stem(0:N-1,h);
title('Input Sequence h(n)');
xlabel('n');
ylabel('h(n)');
subplot(2,2,3);
stem(lags,c);
title('Correlation of x(n) and h(n)');
subplot(2,2,4);
stem(0:N-1,y);
title('Convolution of x(n) and h(n)');

Output:
Enter Input Sequence for Signal x(n): [1 2 3]
Enter Input Sequence for Signal h(n): [4 5]
Convolved sequence using matlab function:
4 13 22 15
Convolved sequence using convolution sum formula:
4 13 22 15

Input Sequence x(n) Input Sequence h(n)


3 6

2 4
x(n)

h(n)
1 2

0 0
0 1 2 3 0 1 2 3
n n
Correlation of x(n) and h(n) Convolution of x(n) and h(n)
30 30

20 20

10 10

0 0
-2 -1 0 1 2 0 1 2 3

Result:
In this experiment convolution and correlation of two sequences have been obtained using
MATLAB.

Post Lab Questions:


1. State the shift property, width property and associative property of convolution.
2. State Parseval’s Theorem.
3. What is the relation between convolution and correlation?
4. What are the applications of Auto correlation and Cross correlation.
5. What is the Fourier transform of Cross correlation?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy