SS Lab 4
SS Lab 4
SS Lab 4
Bachelor of Technology
IN
ELECTRONICS AND TELECOMMUNICATION
ENGINEERING
SUBMITTED BY
NAME: MONISH DAS ROLL NO.: 23/202 ASTU ROLL NO.: 230610014036
SEPTEMBER,2024
1
Aim 4: To perform convolution on different discrete time signals.
Software used: MATLAB R2024a
Theory:
MATLAB is a high-performance language for technical computing. The name MATLAB stands
for matrix laboratory. MATLAB was originally written to provide easy access to matrix software
developed by the LINPACK and EISPACK projects, which together represent the state-of-the-art
in software for matrix computation. It integrates computation, visualization, and programming in
an easy to-use environment where problems and solutions are expressed in familiar mathematical
notation.
Typical uses include:
• Math and computation
• Algorithm development
• Modeling, simulation, and prototyping
• Data analysis, exploration, and visualization • Scientific and engineering graphics
• Application development, including Graphical User Interface building
MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows us to solve many technical computing problems, especially those with
matrix and vector formulations, in a fraction of the time it would take to write a program in a
scalar noninteractive language such as C or Fortran.
For two discrete-time signals ( x[n] ) and ( h[n] ), the convolution ( y[n] = x[n] * h[n] ) is
computed by summing the products of ( x[k] ) and a time-shifted version of ( h[n - k] ) over all
possible values of ( k ).
In practice, this sum is often limited by the signal lengths. Convolution allows for operations like
filtering, where ( h[n] ) is the filter's impulse response applied to an input signal ( x[n] ). The
resulting signal ( y[n] ) captures how ( x[n] ) is shaped by ( h[n] ), making convolution essential
in applications like audio processing, image processing, and communications.
2
Program:
clc;
close all;
clear
all;
x1 =
input('E
nter First
sequence
x1: ');
t1 = input('Enter Origin location Of Sequence x1 : ');
x2 = input('Enter Second sequence x2 : ');
t2 = input('Enter Origin location Of Sequence x2 : ');
l1 = length(x1); %length of sequence x1
l2 = length(x2); %length of sequence x2
ln = l1+l2-1; %length of convoluted sequence
y = conv(x1,x2); % performing convolution using conv() function
a = t1+l1-1;
t = t1:a;
subplot(3,1,1);
stem(t,x1);
xlabel('Time');
ylabel('Amplitude');
title('x1');
a = t2+l2-1;
t = t2:a;
subplot(3,1,
2);
stem(t,x2);
3
xlabel('Time');
ylabel('Amplitude');
tn = t1+t2;
a = tn+ln-1;
t = tn:a;
subplot(3,1,3);
disp('Convoluted Sequence ');
disp(y); % For printing the
convulated output in
MATLAB command window
stem(t,y); % For plotting the convulated output in MATLAB graph window
xlabel('Time');
ylabel('Amplitude');
title('Convoluted Sequence');
Output Graphs:
Result: Hence the given signal is obtained from convolution of two different discrete time
signals.
4
5