%% Checking my answer to PS#2, Q1(b)
%% and getting some experience using the convolution;

nx = [-5:3];
x  = [0, 0, 1, 0, 1, 2, 1, 0, 0];
subplot(311);
stem(nx,x);
ylabel('x[n]');
xlabel('n');

nh = [-3:4];
h  = [0, 2, -1, 1, 0, 2, -1, 0];
subplot(312);
stem(nh,h);
ylabel('h[n]');
xlabel('n');

y = conv(x,h);
ny = [-8:-9+length(y)];
subplot(313);
stem(ny,y);
ylabel('y[n] = conv(x,h)');
xlabel('n');


