%% Partial-Fraction Expansion of IIR Lowpass Filter
% Compute the partial-fraction expansion corresponding to the third-order IIR lowpass filter described by the transfer function
% H(z)={{0.05634(1+z^{-1})(1-1.0166z^{-1}+z^{-2})}
% \over{(1-0.683z^{-1})(1-1.4461z^{-1}+0.7957z^{-2})}}.
% Express the numerator and denominator as polynomial convolutions.

b0 = 0.05634;
b1 = [1  1];
b2 = [1 -1.0166 1];
a1 = [1 -0.683];
a2 = [1 -1.4461 0.7957];

b = b0*conv(b1,b2);
a = conv(a1,a2);

%
% Compute the residues, poles, and direct terms of the partial-fraction expansion.

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

%
% Plot the poles and zeros of the transfer function and overlay the poles you just found.

zplane(b,a)
hold on
plot(p,'^r')
hold off

%
% Use residuez again to reconstruct the transfer function.

[bn,an] = residuez(r,p,k)

% Copyright 2012 The MathWorks, Inc.