www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ExpansionWithComplexRootsAndEqualDegOfNumAndDenExample.m

    %% Expansion with Complex Roots and Equal Degree of Numerator and Denominator
% If the degree of the numerator is equal to the degree of the denominator,
% the output |k| can be nonzero. 
% 
% Find the partial fraction expansion of a ratio of two polynomials
% _F_(_s_) with complex roots and equal degree of numerator and
% denominator, where _F_(_s_) is 
% 
% $$F(s) = \frac{b(s)}{a(s)} = \frac{2s^3+s^2}{s^3+s+1}.$$
% 

% Copyright 2015 The MathWorks, Inc.

b = [2 1 0 0];
a = [1 0 1 1];
[r,p,k] = residue(b,a)
%% 
% |residue| returns the complex roots and poles, and a constant term
% in |k|, representing the partial fraction expansion
% 
% $$F(s) = \frac{b(s)}{a(s)} = \frac{2s^3+s^2}{s^3+s^2+1} =
% \frac{0.5354+1.0390i}{s-(0.3412+1.1615i)} + \frac{0.5354-1.0390i}{s-(0.3412-1.1615i)} +
% \frac{-0.0708}{s+0.6823}+2.$$