You are on page 1of 2

ECX-316 Digital Signal Processing Laboratory 2018

EXPERIMENT NO. 3
AIM: TO PLOT LINEAR CONVOLUTION OF TWO SIGNALS WITH INBUILT FUNCTION
AND WITHOUT INBUILT FUNCTION.

SOFTWARE REQUIRED: MATLAB VERSION: 8.1.0.604 (R2015a)

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. Linear convolution is the basic operation to
calculate the output for any linear time invariant system given its input and its impulse response.
Circular convolution is the same thing but considering that the support of the signal is periodic (as
in a circle, hence the name).

DESIGN SETUP:

clc
clear all
x=input('Enter x: ')
h=input('Enter h: ')
%with conv function
conv(x,h)

%without conv function


m=length(x);
n=length(h);
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
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

subplot(3,1,1)
stem(X)
title('15104027')
ylabel('X[n]');
xlabel('------------->n');
subplot(3,1,2)
stem(H)
ylabel('H[n]');
xlabel('------------->n');
subplot(3,1,3)
stem(Y);
title('Convolution of Two Signals ')
ylabel('Y[n]');
xlabel('------------->n');

9 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar
ECX-316 Digital Signal Processing Laboratory 2018

RESULTS

ans =

2 8 10 8 9 6 0 2 0

15104027
2
X[n]

0
1 2 3 4 5 6 7 8 9 10
------------->n

4
H[n]

0
1 2 3 4 5 6 7 8 9 10
------------->n
Convolution of Two Signals
10
Y[n]

0
1 2 3 4 5 6 7 8 9
------------->n

CONCLUSION

Hence the convolution of two signals is done in MATLAB successfully

10 Department of Elect. and Comm. Engg. , Dr. B R Ambedkar National Institute of Technology, Jalandhar