%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3.1a)
xx = 256*(rem(0:100,50)<10);
b=[1 -0.9];
w = conv(b, xx);
nn = 0:75;

subplot(2,1,1)
stem(nn, xx(1+nn))
subplot(2,1,2)
stem(nn, w(1+nn),'filled')
xlabel('Time Index (n)')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3.1.1a,b)
r = 0.9;
M = 22;
bb = r.^[0:M];

y = conv(bb,w);
subplot(2,1,1)
stem(nn, w(1+nn))
subplot(2,1,2)
stem(nn, y(1+nn),'filled')
xlabel('Time Index (n)')


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3.1.1c)
nn = 0:49;
subplot(1,1,1)
stem(nn, (xx(nn+1)-y(nn+1)))
%plot(nn, (xx(nn+1)-y(nn+1)))

