0% found this document useful (0 votes)
24 views

Lab 4 Convolution

This document describes discrete time convolution, which is used to compute the output of a linear time-invariant system given its impulse response and input signal. It provides the mathematical definition of discrete time convolution and explains how to compute it using MATLAB's conv command or by implementing convolution as a sum of shifted and scaled impulse responses using loops. The objectives are to understand discrete time convolution and perform it in MATLAB.

Uploaded by

Zia Ullah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Lab 4 Convolution

This document describes discrete time convolution, which is used to compute the output of a linear time-invariant system given its impulse response and input signal. It provides the mathematical definition of discrete time convolution and explains how to compute it using MATLAB's conv command or by implementing convolution as a sum of shifted and scaled impulse responses using loops. The objectives are to understand discrete time convolution and perform it in MATLAB.

Uploaded by

Zia Ullah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DSP Lab Manual, Electrical Engineering Department, COMSATS Institute of IT, Islamabad

LAB # 4
DISCRETE TIME CONVOLUTION

OBJECTIVE:
The basic objective of this lab is to perform the convolution in Matlab.

1. DISCRETE TIME CONVOLUTION:

An LTI discrete-time system is (equivalently to the continuous-time case) completely describes


by impulse response, which is usually denoted by h[n] . The impulse response of an LTI discrete-
time system is the output of the system when the unit impulse sequence is applied as input. Even
though the unit impulse input consists of one no-zero term, the impulse response signal h[n]
usually consists of more than one non-zero elements. The explanation is that the system is
dynamic (with memory); that is, the system responds over various time instances to the output
applied at n = 0 . The knowledge of the impulse response h[n]of a system allows the computation
of the response y[n] of the system to any input signal x[n] . The output signal is
computed by discrete time convolution. The mathematical expression of discrete time
convolution is

The convolution between two discrete time signals is computed by using the MATLAB
command conv.

2.1 COMPUTATION OF DISCRETE TIME CONVOLUTION:

The process that has to be followed to analytically derive the convolution sum is as follows.
First, the input and impulse response signals are plotted in the k -axis. One of the two signals is
reversed about the amplitude axis and its reflection is shifted from -∞ to +∞ by changing
appropriately the value of n. The output of the system is computed from the overlapping values
of x[n]and h[n - k] according to the convolution sum

1
DSP Lab Manual, Electrical Engineering Department, COMSATS Institute of IT, Islamabad

There are three basic principles that should be considered while computing the convolution
between two discrete time signals x[n] and h[n]using conv command as follows:

y=conv (x,h)

1. The length and time inyerval of input and impulse response should be same.
2. There should be no overlap between interval for input and impulse response signal.
3. The length of output vector ‘y’ should be calculated by following formulae:

length( y )=length( x )+length( h )-1.

2. If non zeros values of x[n] are in the interval [ ax , bx ] and non zero values of h[n] are in the
Interval [ah , bh] then the non zero values of the output y[n] are in the interval [ ax+ah , bx+bh ].

2.2 CONVOLUTION AS SUM OF SHIFTED AND SCALED IMPULSE RESPONSE:

• For any given n, one point convolution is evaluated as

– Step 1: time reversal of either signal (e.g., x[k] x[-k] or h[k] h[-k] )

– Step 2: shift h [-k] by n samples to obtain h [n-k]

– Step 3: multiply x [k] and h [n-k] for each k and then take the summation over k

2.3 CONVOLUTION USING LOOPS

Convolution can also be evaluated by using loops and if else statement with the following code:

Code:

x=[1 2 3 4]; h=[4 4 3 2];


m=length(x)

2
DSP Lab Manual, Electrical Engineering Department, COMSATS Institute of IT, Islamabad

n=length(h)
X=[x,zeros(1,m)]
H=[h,zeros(1,n)]
for i=1:n+m-1
Y(i)=0
for j=1:m
if(i-j+1>0)
Y(i)=Y(i)+X(j)*H(i-j+1);
else
end
end
end
Y;
stem(Y)
ylabel('Y[n]')
xlabel('----->n');

3
DSP Lab Manual, Electrical Engineering Department, COMSATS Institute of IT, Islamabad

Lab Tasks
In-Lab Task 01: Compute convolution of following signals by using 'conv' command and loops

Post-Lab Task 01: Compute convolution of following signals by using 'conv' command and
loops

You might also like