LAB # 02 Discrete-Time Convolution: Objective
LAB # 02 Discrete-Time Convolution: Objective
Discrete-Time convolution
OBJECTIVE:
1. We have the impulse response of a system as h(n)={3, 2, 1, -2, 1, 0, -4, 0, 3}.
2. For x(n)={1, -2, 3, -4, 3, 2, 1} ,find y(n).
3. Modify the code such that h(n)={ 3, 2, 1, -2, 1, 0, -4, 0, 3}-(origin is shifted),and check the
THEORY:
k=
x ( k ) h ( nk )=
k=
can compute the output y(n) to a certain input x(n) when impulse response h(n) of that system
is known. Convolution holds commutative property.
2. The length of the resulting convolution sequence is N+M-1, where, N and M are the lengths
of the two convolved signals respectively.
3. In Causal Systems, the output only depends on the past and/or present values of inputs and
NOT on future values. This means that the impulse response h(n) of a causal system will
always exist only for n 0.
PROCEDURE:
1. Make a folder at desktop and name it as your current directory within MATLAB.
2. Open M-file editor write the below code:
clear all
close all
clc;
h=[3 2 1 -2 1 0 -4 0 3];
org_h=1;
nh=[0:length(h)-1]-org_h+1;
x=[1 -2 3 -4 3 2 1];
org_x=1;
nx=[0:length(x)-1]-org_x+1;
y=conv(h,x);
ny=[nh(1)+nx(1):nh(end)+nx(end)];
figure,
subplot(1,3,1),
stem(nh,h);
xlabel('time index n');ylabel('amplitude');
xlim([nh(1)-1 nh(end)+1]);
title('impulse response');grid;
subplot(1,3,2),
stem(nx,x);
xlabel('time index n');ylabel('amplitude');
xlim([nx(1)-1 nx(end)+1]);
title('input signal x(n)');grid;
subplot(1,3,3)
stem(ny,y)
xlabel('time index n');ylabel('amplitude');
xlim([ny(1)-1 ny(end)+1]);
title('output obtained by convolution');grid;
3.
4.
RESULT:
EXERCISE:
1. What will happen if we input x(n)={0,0,1,0,0} into the above system.
2. Can you prove commutative property of the convolution?
3. Perform the convolution without conv command.