clc;
clf;

N = 5;

x = ones(1, N);
l = length(x);
n = 0 : l - 1;

subplot(3, 1, 1);
stem(n, x, 'Linewidth', 1.5, 'r');
title('Input Sequence x(n)');
xlabel('n');
ylabel('Amplitude');
grid on;

h = ones(1, N);
m = length(h);
p = 0 : m - 1;

subplot(3, 1, 2);
stem(p, h, 'Linewidth', 1.5, 'b');
title('Impulse Response h(n)');
xlabel('n');
ylabel('Amplitude');
grid on;

y = conv(x, h);
a = 0 : l + m - 2;

subplot(3, 1, 3);
stem(a, y, 'Linewidth', 1.5, 'g');
title('Convolved Output y(n)');
xlabel('n');
ylabel('Amplitude');
grid on;

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: