clf

x = [1 2 3 4 5];
nx = -1:3;
v = [-1 5 3 -2 1];
nv = -2:2;

y=conv(x,v);
ny = nx(1)+nv(1):nx(1)+nv(1)+length(x)+length(v)-2;

subplot(311)
stem(nx,x)
axis([-4 6 -4 6])
grid
title('Convolution:  y[n] = x[n] * y[n]')
subplot(312)
stem(nv,v)
axis([-4 6 -4 6])
ylabel('x[n]')
grid
subplot(313)
ylabel('v[n]')
stem(ny,y)
axis([-4 6 -10 40])
grid
ylabel('y[n]')
xlabel('n')
