%% Find Partial Fraction Expansion with Real Roots
% Find the partial fraction expansion of the following ratio of polynomials F(s) using residue
% F(s)=\frac{b(s)}{a(s)}=\frac{-4s+8}{s^2+6s+8}.

b = [-4 8];
a = [1 6 8];
[r,p,k] = residue(b,a)

%
% This represents the partial fraction expansion
% \frac{-4s+8}{s^2+6s+8}=\frac{-12}{s+4}+\frac{8}{s+2}.
% Convert the partial fraction expansion back to polynomial coefficients using residue.

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

% This result represents the original fraction F(s).
% Copyright 2015 The MathWorks, Inc.