B.E.
(Fifth Semester) Signals & Systems (3150912)
LAB MANUAL
SIGNALS & SYSTEMS
(3150912)
B.E. FIFTH SEMESTER
ELECTRICAL ENGINEERING
Name: -
Enrolment No.:-
SAL INSTITUTE OF TECHNOLOGY ENGINEERING RESEARCH,
[Link] CITY,BHADAJ,
AHMEDABAD-380060
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
SAL INSTITUTE OF TECHNOLOGY AND ENGINEERING
RESEARCH
Opp. Science City, Sola-Bhadaj Road, Ahmedabad
CERTIFICATE
This is to certify that
Mr. /Ms. _______________________________ Roll No
__________________________Of _______ Year/Sem Degree course in
____________________________________________ has satisfactorily
completed his /her term work in ________________________ within four
walls of this college during the year 20 to 20.
Place: __________________ Enrollment No: __________________
Date: __________________ Exam No.: ______________________
Subject Teacher Head of Department Principal
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
INDEX
Sr. No. Title Date Grade Sign
To understand the basic commands used in
1. MATLAB
To understand Basic loops and plotting in
2. MATLAB.
To generate periodic and Aperiodic signals
3 using MATLAB.
4 To Perform basic operations on signals
Finding even and odd part of the signal
5
6 Finding even and odd part of the given
Sequence
7 Write the program for convolution between two
signals
8 To find the sinusoidal amplitude modulation of
the signal
9 To find Laplace and inverse Laplace of signals
using MATLAB
10 To find DFT of a signal using MATLAB.
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-1
Date: _______________
Aim: - To understand the basic commands used in MATLAB
MATLAB consists of four windows. They are Command window, the Figure window, the
Editor window and the Help window.
Command Window: The Command Window is MATLAB’s main window, and opens
when MATLAB is started.
Figure Window: The Figure Window opens automatically when graphics commands are
executed, and contains graphs created by these commands.
Editor Window: The Editor Window is used for writing and editing programs. This
window is opened from the File menu in the command window.
Help Window: The Help window contains help information. This window can be opened
from the Help menu in the toolbar of any MATLAB window.
Notes for working in the Command Window:
To type a command the cursor must be placed next to the command prompt (>>).
Once a command is typed and the ENTER key is pressed, the command is
executed. However, only the last command is executed. Everything executed
previously is unchanged.
Several commands can be typed in the same line. This can be done by typing a
comma between the commands.
It is not possible to go back to a previous line in the command window, make a
correction and then re-execute the command.
A previously typed command can be recalled to the command prompt with the up
arrow key.
The semicolon(;): If a semicolon is typed at the end of a command the output of the
command is not displayed.
Typing %: When the symbol % is typed in the beginning of a line, the line is designated
as a comment.
The clc Command: The clc command clears the command window.
Getting Started:- When MATLAB starts the MATLAB prompt >> appears and now the
MATLAB is ready to excecute all comands.
Operation and special Chrachters : The MATLAB language uses many common
operators and special characters that can use to perform simple operations on arrays of any
[Link] can be classified as
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
Symbol Description
+ Plus; addition operator.
- Minus; subtraction operator
* Scalar and matrix multiplication operator
/ division operator
.* Array multiplication operator.
^ Scalar and matrix exponentiation operator
.^ Array exponentiation operator
: Colon; generates regularly spaced elements and represents an entire row or
column.
() Parentheses; encloses function arguments and array indices; overrides
precedence.
[] Brackets; enclosures array elements.
. Decimal point.
... Ellipsis; line-continuation operator.
, Comma; separates statements and elements in a row.
: Semicolon; separates columns and suppresses display.
= Assignment (replacement) operator.
Complex Building Function:- Entering complex numbers from the keyboard has to be
done carefully. The symbol "i" identifies the imaginary part and has to be typed
immediately after the numerical value of the imaginary part: for example, 2 + 3i . If we
insert a space for instance, 2 + 3 i - it looks like the same expression but it will be
processed as a number ( 2 + 3 ) and a string ( i ), and not as the complex number (2 + 3i).
Command Return Value/Answer
Complex(x,y) Return a complex number x+yi
real(x) Real part of a complex number
imag(x) Imaginary part of a complex number
Abs(x) Magnitude of the complex number
angle(x) Aangle of a complex number x
conj(x) Ccomplex conjugate of the complex number x
Cart2pol Convert Cartesian to Polar form of complex number
Pol2cart Convert Polar to Cartesian form of complex number
Conclusion:- learned the basic commands in MATLAB
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-2
Date: _______________
AIM: To understand Basic loops and plotting in MATLAB.
Software Required:-MATLAB
Variable Controlled loops:- The purpose of loops is to repeat the same, or similar, code a
number of times. This number of times could be specified to a certain number, or the
number of times could be dictated by a certain condition being met
1. For Loop :-The general form is:
for variable = first: inc: last
statements
end
If the increment ‘inc’ is not specified, a default value of 1 is used.
Programm
x=[ ];
for i=1:4
x=[x,i^2]
end
Output
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
2. While loop:-The general form is:
while relation
Statements
end
Programm:-
i=0
while i<3
i=i+1
end
Output
3. If loop:-The general form is:
if relation
true alternative
else
false alternative
end
Plotting:- MATLAB has extensive plotting capabilities. We will examine a simple two-
dimensional plot and add features. The ‘plot’ command graphs the numbers in one array
versus the numbers in a second array of the same length. For example
t=0:0.01:2;
Temp=exp(-t);
plot(t,Temp)
xlabel('Time')
ylabel('Life')
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
title('Our destiney')
Colours ,Symbols and line types:- We can change colours, symbols and line types as
demonstrated below
Short Name Long Name
m Yellow
y Magenta
c Cyan
r Red
g Green
b Blue
w White
k black
x=0:pi/16:2*pi;
y=sin(x);
plot(x,y,'r *--')
xlabel ('x')
ylabel ('sin(x)')
Output
Multiple plots on single graph
x=0:pi/16:2*pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,'* -',x,y2,'r s -')
xlabel('x')
ylabel('sin(x), cos(x)')
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
title('Trig Functions')
legend('sin','cos')
Output
Conclusion:-Learned various loops and plotting section of MATLAB
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-3
Date: _______________
AIM: To generate periodic and Aperiodic signals using MATLAB.
Software Required:-MATLAB
Theory:- If the amplitude of the signal is defined at every instant of time then it is called
continuous signal. If the amplitude of the signal is defined at only at some instants of time
then it is called discrete signal.
If the signal repeats itself at regular intervals then it is called periodic signal.
Otherwise they are called aperiodic signals.
Ramp,Impulse,Unit step, are the Aperiodic signals
Square, Triangular sinusoidal – periodic signals.
Generation of Aperiodic Signals
1. Ramp Signal
fs=500;
t=0:1/fs:0.1;
y1=t;
subplot(2,2,1);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('ramp signal')
Output:-
2. Impusle Signals
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
fs=500;
t=0:1/fs:0.1;
y2=(t==0);
plot(t,y2);
axis([-1 1 0 1])
xlabel('time');
ylabel('amplitude');
title('impulse signal');
Output
3. Unit Step Signal
n=-10:1:10
y3=(n>=0);
plot(n,y3);
xlabel('time');
ylabel('amplitude');
title('unit step signal');
Output
Generattion of periodic Signals
4. Square Signal
y4=square(2*pi*50*t);
plot(t,y4);
axis([0 0.1 -2 2]);
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
xlabel('time');
ylabel('amplitude');
title('square wave signal');
Output
5. Triangular Sinusoidal Signal
y5=sawtooth(2*pi*50*t,.5);
plot(t,y5);;
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title(' triangular wave signal');
Output
Conclusion:-By using MATLAB periodic and aperiodic signals have been drawn
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-4
Date: _______________
AIM: To Perform basic operations on signals.
Software Required:-MATLAB
Theory:-The basic operations which can be performed on signals can be given as:-
Addition:- any two signals can be added to form a third signal,
z (t) = x (t) + y (t)
Multiplication:- Multiplication of two signals can be obtained by multiplying their values
at every instants .
z (t) = x (t) y (t)
Time reversal/Folding: Time reversal of a signal x(t) can be obtained by folding the
signal about t=0.
Y(t)=y(-t)
Signal Amplification/Scaling:- Y(n)=ax(n) if a < 1 attenuation
a >1 amplification
Program for generating two signal Inputs
n1=1:1:9;
s1=[1 2 3 0 5 8 0 2 4];
figure;
subplot(2,2,1);
stem(n1,s1);
xlabel('n1');
ylabel('amplitude');
title('input signal 1');
s2=[1 1 2 4 6 0 5 3 6];
subplot(2,2,2);
stem(n1,s2);
xlabel('n2');
ylabel('amplitude');
title('input signal 2');
%Addition of Signals
s3=s1+s2;
subplot(2,2,3);
stem(n1,s3);
xlabel('n1');
ylabel('amplitude');
title('sum of two signals');
%Multiplication of signals
s4=s1.*s2;
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
subplot(2,2,4);
stem(n1,s4);
xlabel('n1');
ylabel('amplitude');
title('product of two signals');
Output
Scaling Operation on signals
x=[0 0 0 1 1 2 3 4 0 0 0];
c1=1;
for i=1:length(x)/2
x4(c1)=x(2*i);
c1=c1+1;
end
figure
subplot(211),stem(x),title('Original Signal')
subplot(212),stem(x4),title('Time-scaled Signal')
Output:-
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
Folding Operation on signals
x=[0 0 0 1 1 2 3 4 0 0 0];
x3=fliplr(x);
figure
subplot(211),stem(x),title('Original Signal')
subplot(212),stem(x3),title('Folded Signal')
Output:-
Conclusion:-Basic Operation on signals using MATLAB has been performed
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-5
Date: _______________
AIM: Finding even and odd part of the signal
Software Required:-MATLAB
Theory:- One of characteristics of signal is symmetry that may be useful for signal
analysis. Even signals are symmetric around vertical axis, and Odd signals are symmetric
about origin
Even Signal: A signal is referred to as an even if it is identical to its time-reversed
counterparts; x(t) = x(-t).
Odd Signal: A signal is odd if x(t) = -x(-t). An odd signal must be 0 at t=0, in other words,
odd signal passes the origin.
Program:-
clc
close all;
clear all
%Even and odd parts of a signal
t=0:.001:4*pi;
x=sin(t)+cos(t); % x(t)=sint(t)+cos(t)
subplot(2,2,1)
plot(t,x)
xlabel('t');
ylabel('amplitude')
title('input signal')
y=sin(-t)+cos(-t); % y(t)=x(-t)
subplot(2,2,2)
plot(t,y)
xlabel('t');
ylabel('amplitude')
title('input signal with t= -t')
even=(x+y)/2;
subplot(2,2,3)
plot(t,even)
xlabel('t');
ylabel('amplitude')
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
title('even part of the signal')
odd=(x-y)/2;
subplot(2,2,4)
plot(t,odd)
xlabel('t');
ylabel('amplitude');
title('odd part of the signal');
Output:-
Conclusion:- By using MATLAB Even and odd part of signal has been found.
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-6
Date: _______________
AIM: Finding even and odd part of the given Sequence
Software Required:-MATLAB
Program:
clc
close all;
clear all;
% Even and odd parts of a sequence
x1=[0,2,-3,5,-2,-1,6];
n=-3:3;
y1= fliplr(x1);%y1(n)=x1(-n)
figure;
subplot(2,2,1);
stem(n,x1);
xlabel('n');
ylabel('amplitude');
title('input sequence');
subplot(2,2,2);
stem(n,y1);
xlabel('n');
ylabel('amplitude');
title('input sequence with n= -n');
even1=.5*(x1+y1);
odd1=.5*(x1-y1);
% plotting even and odd parts of the sequence
subplot(2,2,3);
stem(n,even1);
xlabel('n');
ylabel('amplitude');
title('even part of sequence');
subplot(2,2,4);
stem(n,odd1);
xlabel('n');
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
ylabel('amplitude');
title('odd part of sequence');
Output:-
Conclusion:- Even and odd part of the Sequence is plotted in MATLAB.
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-7
Date: _______________
AIM: Write the program for convolution between two signals
Software Required:-MATLAB
Theory:- Convolution is a mathematical way of combining two signals to form a
third signal. It is the single most important technique in Digital Signal Processing. Using
the strategy of impulse decomposition, systems are described by a signal called the impulse
response.
Convolution involves the following operations.
1. Folding
2. Multiplication
3. Addition
4. Shifting
Following rules are followed in Convolution
Convolution of two causal sequences is causal.
Convolution of two anti causal sequences is anti causal.
Convolution of two unequal length rectangles results a trapezium.
Convolution of two equal length rectangles results a triangle.
A function convoluted itself is equal to integration of that function.
Program
t=0:0.1:10;
x1=sin(2*pi*t);
h1=cos(2*pi*t);
y1=conv(x1,h1);
figure;
subplot(3,1,1);
plot(x1);
xlabel('t');
ylabel('x(t)');
title('input signal')
subplot(3,1,2);
plot(h1);
xlabel('t');
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
ylabel('h(t)');
title('impulse response')
subplot(3,1,3);
plot(y1);
xlabel('n');
ylabel('y(n)');
title('linear convolution');
Output
Conclusion:-Linear Convolution is plotted using MATLAB
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-8
Date: _______________
AIM: To find the sinusoidal amplitude modulation of the signal
Software Required:-MATLAB
Theory:-Amplitude modulation (AM) is a modulation technique used in electronic
communication, most commonly for transmitting messages with a radio carrier wave. In
amplitude modulation, the amplitude (signal strength) of the carrier wave is varied in
proportion to that of the message signal, such as an audio signal. This technique contrasts
with angle modulation, in which either the frequency of the carrier wave is varied as
in frequency modulation, or its phase, as in phase modulation.
AM was the earliest modulation method used for transmitting audio in radio broadcasting.
It was developed during the first quarter of the 20th century .This original form of AM is
sometimes called double-sideband amplitude modulation (DSBAM), because the standard
method produces sidebands on either side of the carrier frequency. Single-sideband
modulation uses bandpass filters to eliminate one of the sidebands and possibly the carrier
signal, which improves the ratio of message power to total transmission power, reduces
power handling requirements of line repeaters, and permits better bandwidth utilization of
the transmission medium.
Program
close all;
clc;
t=0:0.01:10;
f=0.01;
a=cos(2*pi*f*t);
subplot(3,1,1);
plot(t,a);
xlabel('time-->');
ylabel('amplitude-->');
title('modulating Waveform');
f=0.1;
b=sin(2*pi*f*t);
subplot(3,1,2);
plot(t,b);
xlabel('time-->');
ylabel('amplitude-->');
title('sine-wave carrier Waveform');
c=a.*b;
subplot(3,1,3);
plot(t,c);
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
xlabel('time-->');
ylabel('amplitude-->');
title('modulated Waveform')
Output:-
Conclusion:-Modulated waveform for communication is obtained using MATLAB
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-9
Date: _______________
AIM: To find Laplace and inverse Laplace of signals using MATLAB.
Software Required:-MATLAB
Program:-
To find Laplace of v = 3e -2tsin5t + 4e -2tcos5t
syms t s
v=3*exp(-2*t)*sin(5*t)+4*exp(-2*t)*cos(5*t)
V=laplace(v)
H=simplify(V);
pretty(H)
Output:-
v=
(4*cos(5*t))/exp(2*t) + (3*sin(5*t))/exp(2*t)
V=
(4*(s + 2))/((s + 2)^2 + 25) + 15/((s + 2)^2 + 25)
H=
(4*s + 23)/(s^2 + 4*s + 29)
To find inverse Laplace of F =
syms t s
F=50*(s+3)/((s+1)*(s+2)*(s^2+2*s+5))
f=ilaplace(F);
f=simplify(f);
pretty(f)
Output:-
F=
(50*s + 150)/((s + 1)*(s + 2)*(s^2 + 2*s + 5))
f=
25/exp(t) - 10/exp(2*t) - (15*(cos(2*t) + sin(2*t)/3))/exp(t)
Conclusion: Hence we can find the laplace and inverse laplace of signals using the above
MATLAB code.
Date of Completion: Signature of Faculty
Electrical Department (SALITER)
B.E. (Fifth Semester) Signals & Systems (3150912)
EXPERIMENT-10
Date: _______________
AIM: To find DFT of a signal using MATLAB.
Software Required:-MATLAB
Program
x1=1:10;
x2=fft(x1);
figure subplot(221),stem(x1),title('Original signal')
subplot(222),stem(x2),title('DFT signal')
subplot(223),stem(abs(x2)),title('magnitude response of the signal')
subplot(224),stem(angle(x2)),title('Phase response of the signal')
Output
Conclusion: Hence folding operation is performed on the signal using the above
MATLAB code.
Date of Completion: Signature of Faculty
Electrical Department (SALITER)