% Jonathon Panek
% EE 416
% Project 1
% Due 10/18/01
% =======================================================================
% Create matrices num & den for the coefficients of the transfer function
    num=[0.025 -0.07 0.05 -0.02 0];
    den=[1 1.5 1.75 1.02 0.4];
% This function specifies a discrete time transfer function
% Here it is only used to display the function in the command window!
    dt_sys=tf([0.025 -0.07 0.05 -0.02],[1 1.5 1.75 1.02 0.4],0.001)
% Residuez creates the partial fraction expansion
% The poles and zeroscome from the p.f. expansion
    [z,p,k]=residuez(num,den)
% zplane plots the zeros and poles on the Re and Im axis  
    figure(1);
    zplane(z,p);
% freqz creates the frequency response of the transfer function
% over the whole unit circle
    figure(2);
    freqz(num,den,'whole');
% x is to pad with zeros for 35 samples
    x = [1 zeros(1,35)];
% filter function gives h[n] 
    h=filter(num,den,x);
    figure(3);
    stem(h);
    title('h[n]');
    xlabel('Samples 0 < n < 35');
    ylabel('h[n]');
    grid;
    
% This system is BIBO stable because all poles are within the unit 
% circle (|z| < 1 at all pole locations) and lie 
% on the left half of the z-plane. Also, the degree of the numerator
% is not larger than the degree of the denominator.
