You are on page 1of 2

EXPERIMENT NO.

OBJECTIVE:
Write a program for computing
(a) Linear Convolution
(b) Circular Convolution
(c) Auto-correlation
(d) Cross-correlation of the sequence
x=[1 2] and h[1 2 4]

APPRATUS:- Use Software(MATLAB VERSION R2012a(7.14.0.739))

PROGRAM:
%program for linear convolution
x=input('enter the first sequence x(n):');
h=input('enter the second sequence h(n):');
y=conv(x,h)
subplot(3,2,1);
stem(x)
xlabel('time');
ylabel('amplitude');
title('input sequence');
subplot(3,2,2);
stem(h)
xlabel('time');
ylabel('amplitude');
title('impulse sequence');
subplot(3,2,3);
stem(y)
xlabel('time');
ylabel('amplitude');
title('linear convolution');

%program for circular convolution


y1=cconv(x,h,3)
subplot(3,2,4);
stem(y1)
xlabel('time');
ylabel('amplitude');
title('circular convolution');

%program for auto convolution


y2=xcorr(x)
subplot(3,2,5);
stem(y2)
xlabel('time');
ylabel('amplitude');
title('auto convolution');

PARAS JAIN
14315604914
%PROGRAM for cross convolution
y3=xcorr(x,h)
subplot(3,2,6);
stem(y3)
xlabel('time');
ylabel('amplitude');
title('cross convolution');

INPUT
enter the first sequence x(n):[ 1 2 ]

enter the second sequence h(n):[1 2 4]

OUTPUT
y= 1 4 8 8

y1 = 9 4 8

y2 = 2 5 2

y3 = 4.0000 10.0000 5.0000 2.0000 0.0000

PARAS JAIN
14315604914

You might also like