The Islamia University of Bahawalpur: University College of Engineering &technology Signals and Systems Lab 5
The Islamia University of Bahawalpur: University College of Engineering &technology Signals and Systems Lab 5
The Islamia University of Bahawalpur
University College of Engineering &Technology
SIGNALS AND SYSTEMS LAB‐5
EXPERIMENT # 05: DISCRETE TIME CONVOLUTION
Name of Student: __________________________________
Roll No.: _________________________________________
DATE: __________________________________________
Instructor’s Signature: ……………………………...
Instructor: Engr. Abdul Rehman Chishti
Department of Telecommunication Engineering
Convolution of Discrete‐Time Signals
1. Objectives:
To study basics of convolution in discrete time signals.
Generation of convolved signal by the convolution of discrete signals.
2. Background & Concepts
Convolution is denoted by: y[n] = x[n] * h[n].
9 First, we set up two signals x[k] and h[k]:
9 Flip one of the signals, say h[k], to form h[‐k]
Shift h[‐k] by n to form h[n‐k]. For each value of n, form y [n] by multiplying and summing all
the element of the product of x [k]h[n‐k],Starting, from ‐ ∞ to + ∞, first partial overlap then
complete overlap and then end at no overlap. The figure below shows an example of the
calculation of y[1]. The top panel shows x[k]. The middle panel shows h[1‐k]. The lower
panel shows x[k]y[1‐k]. Note that this is a sequence on a k axis. The sum of the lower
sequence over all k gives y[1]=2 .
Length of Convolution Sum = length of x[n] + length of h[n] – 1
Starting index of Convolution Sum = Starting index of x[n] + Starting index of h[n]
Ending index of Convolution Sum = Ending index of x[n] + Ending index of h[n]
We repeat this shifting, multiplication and summing for all values of n to get the
complete sequence y[n]:
An easy approach to convolve the above signals is the polynomial multiplication.
Since x[n] and h[n] in the above example are finite sequences then we can use
polynomial multiplication as follows.
Length of Convolution Sum = length of x[n] + length of h[n] – 1
= 5 + 3 –1 = 7
1 1 1 1 1
1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
y[n]: 1 2 3 3 3 2 1
n: 0 1 2 3 4 5 6
Starting index of Convolution Sum = Starting index of x[n] + Starting index of h[n]
= 0 + 0 = 0
Ending index of Convolution Sum = Ending index of x[n] + Ending index of h[n]
= 4 + 2 = 6
3. MATLAB Commands
The conv Command
conv(a,b) performs convolution of vectors a and b. The result is a vector with
length = length(a) + length(b) ‐ 1.
Imagine vector a as being stationary and the flipped version of b is slid from left to right. Note
that conv(a,b) = conv(b,a).
%This m‐file convolves two signals and plots the result.
x = [0.5 0.5 0.5]; %define input signal x[n]
h = [3.0 2.0 1.0]; %unit‐pulse response h[n]
y = conv(x,h); %compute output y[n] via convolution
n = 0:(length(y)‐1); %for plotting y[n]
stem(n,y); % plot y[n]
xlabel('n');
ylabel('y[n]');
title('Convolution Output');
PRACTICE PROBLEM
PROBLEM1: Write a MATLAB code to convolve the following two signals.
X[n]= [1 1 1 1 1], h[n] = [ 1 1 1 1 1].
PROBLEM2: Solve the above using time shifting and scaling method. Note: Do not use the
Matlab built in command conv to solve this. Using subplot Compare the Results of Problem1
convolution with this one.
PRBOLEM3: Implement the following in MATLAB, convolve the two signals and plot the
output
x[n]
1
0.5
0
0 5 10 15 20 25 30 35
h[n]
10
0
0 10 20 30 40 50 60
PROBLEM4. Prove the following Convolution Property; use subplot command to compare the
results:
1. x[n]*h[n]=h[n]*x[n];
2. (x1[n]+x2[n])*h[n]= x1[n]*h[n] + x2[n]*h[n]
3. x1[n]*(h1[n]*h2[n])=(x1[n]*h1[n])*h2[n]
where:
x1[n]=x[n]=[ 1 3 2 5 3 1];
h1[n]=h[n]=[ 3 1 2 1 1 1];
h2[n]=[1 1 1 0 1 2];