Contents Previous Next Subchapters Current Chapters-> pol2asc polval polyval polyvalm poladd polmul polcomp polder zero2pol roots poly pol2zero polcheb polyreduce mlmode_conv deconv residue compan monomial Parent Chapters-> Omatrix6 polynomial residue Search Tools-> contents reference index search

Calculate the Residues for a Rational Function in Complex Plane
 Syntax `[`r`, `p`, `k`] = residue (`b`, `a`)` `[`r`, `p`, `k`] = residue (`b`, `a`, `tol`)` See Also poly , conv , deconv

Description
Calculates the residues for a rational function of a complex variable. (This is also called the partial fraction expansion.) The descending polynomials b and a specify the rational function numerator and denominator respectively.

Return Values
The return complex column vectors r, p, and k specify the partial fraction expansion of the rational function in the following fashion: ``` ```
 Name Description Length `r` residues `M` `p` poles `M` `k` direct polynomial `N`
```               M        r               N      b[z]    ---        m             ---       N-n      ----  = >    -------------   +   >    k * z      a[z]    ---           e(m)       ---   n              m=1   (z - p )           n=1                          m ```where for each `m`, the exponent `e(m)` is the maximum integer `j` such ```      p  = p       m    m - j + 1 ```
Tolerance
The tolerance value tol is used to determine whether poles with small imaginary components are considered to be real. It is also used to determine if two poles are distinct. If the ratio of the imaginary part of a pole to the real part is less than tol, the imaginary part is discarded. If two poles are farther apart than tol they are distinct. If the argument tol is not present, value `0.001` is used.

Example
Consider the case ```                   2      b[s]        s  + s + 1          -2          7           3      ---- = -------------------  =  -----  +  --------  +  -----      a[s]    3      2                                2             s  - 5 s  + 8 s - 4     s - 2     (s - 2)      s - 1 ```If you enter ```      b = [1,  1, 1]      a = [1, -5, 8, -4]      [r, p, k] = residue(b, a) ``` O-Matrix will calculate the partial fraction expansion above. If you enter ```      r ``` O-Matrix will reply ```      {      (-2,0)      (7,0)       (3,0)      } ``` which are the residue values in the expansion. If you enter ```      p ``` O-Matrix will reply ```      {      (2,0)      (2,0)      (1,0)      } ``` which are the poles in the expansion. If you enter ```      k ``` O-Matrix will reply ```      { } ``` because the direct term in the expansion is empty.