You are on page 1of 1

Code:

clear all;
clc;

a = [1, 2, 3];
b = [1, 1];

y = conv(a, b);
subplot(311);
stem(a, 'filled');
title('a[n]');
disp(a);
ylabel('Amplitude');
xlabel('N');
xlim([0, 5]);

subplot(312);
stem(b, 'filled');
title('b[n]');
disp(b);
ylabel('Amplitude');
xlabel('N');
xlim([0, 5]);

subplot(313)
stem(y, 'filled');
title('Linear Convolution');
disp(y);
ylabel('Amplitude');
xlabel('N');
xlim([0, 5]);

Output:

You might also like