clear all; clc;

b = [1 -1];
a = 1;
n = 0:1:100;

x = 5*((n>=0)-(n>=20)); %rectangular pulse
y = filter(b,a,x);
figure;

subplot(211);
stem(n,x);
xlabel('n'); ylabel('x(n)');
grid on;
title('Input x(n)=5[u(n)-u(n-20)]');

subplot(212);
stem(n,y);
xlabel('n'); ylabel('y(n)');
grid on;
title('Output x(n)');