LINEAR CONVOLUTION OF TWO SEQUENCES

clc;
close all;
clear all;
x=input('Enter Sequence x:');
h=input('Enter Sequence h:');
y=conv(x,h);
subplot(3,1,1);
stem(x);
axis([0 4 0 10])
grid on;
xlabel('n');
ylabel('x(n)');
subplot(3,1,2);
stem(h);
axis([0 4 0 10])
grid on;
xlabel('n');
ylabel('h(n)');
subplot(3,1,3);
stem(y);
xlabel('n');
ylabel('y(n)');
axis([0 10 0 30])
grid on;
title('Linear Convolution');
disp('The resultant signal is');y

Input:

Enter Sequence x:[1 2 3 4]
Enter Sequence h:[4 3 2 1]


Output:


y =

4 11 20 30 20 11 4

No comments:

Post a Comment