% Erik Kronbeck
% Person # 27601719
% HW # 1

%1.

%coefficients
b=[.025 -.07 .05 -.02];
a=[1 1.5 1.75 1.02 .4];

% the following calculated the poles

[r,p,k] = residuez(b,a);
p

% the following calculates the zeros

z=roots(b)

%2.

figure(1);
X=zplane(b,a);
title('Plot of poles and zeros');

% The plot shows that all of the poles are inside the unit circle and on the left side 
% of the imaginary axis. There are no zeros to the left side of this axis as well. 

%3.

%frequency response of filter
figure(2);
[H,w]=freqz(b,a);     
freqzplot(H,w,'Hz');
title('Plot of the frequency Response H(w)');

%4.

%impulse response of filter with 30 samples
figure(3);
[h,t]=impz(b,a,30);		% the number of samples used is 30
stem(t,h);
title('Plot of the impulse response h(t)');
xlabel('time');
ylabel('h(t)');

%5.

%Looking at the zeros and poles plot you can see that all of the poles have negative
%real values. This means that the filter is stable. 

