Documentation |
Convert between partial fraction expansion and polynomial coefficients
[r,p,k] = residue(b,a)
[b,a] = residue(r,p,k)
The residue function converts a quotient of polynomials to pole-residue representation, and back again.
[r,p,k] = residue(b,a) finds the residues, poles, and direct term of a partial fraction expansion of the ratio of two polynomials, b(s) and a(s), of the form
$$\frac{b(s)}{a(s)}=\frac{{b}_{1}{s}^{m}+{b}_{2}{s}^{m-1}+{b}_{3}{s}^{m-2}+\dots +{b}_{m+1}}{{a}_{1}{s}^{n}+{a}_{2}{s}^{n-1}+{a}_{3}{s}^{n-2}+\dots +{a}_{n+1}}$$
where b_{j} and a_{j} are the jth elements of the input vectors b and a.
[b,a] = residue(r,p,k) converts the partial fraction expansion back to the polynomials with coefficients in b and a.
If there are no multiple roots, then
$$\frac{b(s)}{a(s)}=\frac{{r}_{1}}{s-{p}_{1}}+\frac{{r}_{2}}{s-{p}_{2}}+\dots +\frac{{r}_{n}}{s-{p}_{n}}+k(s)$$
The number of poles n is
n = length(a)-1 = length(r) = length(p)
The direct term coefficient vector is empty if length(b) < length(a); otherwise
length(k) = length(b)-length(a)+1
If p(j) = ... = p(j+m-1) is a pole of multiplicity m, then the expansion includes terms of the form
$$\frac{{r}_{j}}{s-{p}_{j}}+\frac{{r}_{j+1}}{{(s-{p}_{j})}^{2}}+\dots +\frac{{r}_{j+m-1}}{{(s-{p}_{j})}^{m}}$$
b,a | Vectors that specify the coefficients of the polynomials in descending powers of s |
r | Column vector of residues |
p | Column vector of poles |
k | Row vector of direct terms |
Numerically, the partial fraction expansion of a ratio of polynomials represents an ill-posed problem. If the denominator polynomial, a(s), is near a polynomial with multiple roots, then small changes in the data, including roundoff errors, can make arbitrarily large changes in the resulting poles and residues. Problem formulations making use of state-space or zero-pole representations are preferable.
If the ratio of two polynomials is expressed as
$$\frac{b(s)}{a(s)}=\frac{5{s}^{3}+3{s}^{2}-2s+7}{-4{s}^{3}+8s+3}$$
then
b = [ 5 3 -2 7] a = [-4 0 8 3]
and you can calculate the partial fraction expansion as
[r, p, k] = residue(b,a) r = -1.4167 -0.6653 1.3320 p = 1.5737 -1.1644 -0.4093 k = -1.2500
Now, convert the partial fraction expansion back to polynomial coefficients.
[b,a] = residue(r,p,k) b = -1.2500 -0.7500 0.5000 -1.7500 a = 1.0000 -0.0000 -2.0000 -0.7500
The result can be expressed as
$$\frac{b(s)}{a(s)}=\frac{-1.25{s}^{3}-0.75{s}^{2}+0.50s-1.75}{{s}^{3}-2.00s-0.75}.$$
Note that the result is normalized for the leading coefficient in the denominator.