%Problem #3
a4 = [1, -1.8*cos(pi/16), .81];
b4 = [2, 1, 0];
n4 = [0:200]';
x4 = zeros(size(n4));
ind4 = find(n4 >= 0);
x4(ind4) = 1.5*cos(.125*pi*n4 - pi/4);
y4 = filter(b4, a4, x4);
subplot(2,1,1);
stem(n4,x4) ,xlabel('Time in Seconds'), ylabel('Amplitude'), title('Input');
subplot(2,1,2);
stem(n4,y4) ,xlabel('Time in Seconds'), ylabel('Amplitude'), title('Output');
figure;

yss4 = y4(201);
ytr4 = y4 - yss4;
yss5 = zeros(size(n2));
ind5 = find(n4 >= 0);
yss5(ind5) = yss4;
subplot(2,1,1);
stem(n4,yss5) ,xlabel('Time in Seconds'), ylabel('Amplitude'), title('Steady State Response');
subplot(2,1,2);
stem(n4,ytr4);,xlabel('Time in Seconds'), ylabel('Amplitude'), title('Transient Response');
