Wednesday, November 18, 2009

Write a program to perform 1-Dimensional Linear Convolution.

CODE


%x(n)--> Input Sequence% Given-->[1 1 1 1 1]
%h(n)--> Impulse Response% Given-->[1 2 3 4 5 6 7 8]
clc
clear all
close all
x=[1 1 1 1 1];
h=[1 2 3 4 5 6 7 8];
y=conv(x,h);


figure;
subplot(3,1,1);stem(x);
xlabel('n---->');
ylabel('Amplitude---->');
title('Input Sequence');


subplot(3,1,2);stem(h);
xlabel('n---->');
ylabel('Amplitude---->');
title('Impulse Response');


subplot(3,1,3);stem(y);
xlabel('n---->');
ylabel('Amplitude---->');
title('Output Sequence');

No comments:

Post a Comment