DSPRelated.com
Free Books

Partial Fraction Expansion: residued.m

Figure J.9 gives a listing of a matlab function for computing a ``right justified'' partial fraction expansion (PFE) of an IIR digital filter $ H(z)=B(z)/A(z)$ as described in §6.8 (and below).

The code in Fig.J.9 was written to work in Octave, and also in Matlab if the 'm' argument is omitted (in two places).

Figure J.9: Matlab/Octave function for computing the group delay of a digital filter.

 
function [r, p, f, e] = residued(b, a, toler)
if nargin<3, toler=0.001; end
NUM = b(:)';
DEN = a(:)';
nb = length(NUM);
na = length(DEN);
f = [];
if na<=nb
  f = filter(NUM,DEN,[1,zeros(nb-na)]);
  NUM = NUM - conv(DEN,f);
  NUM = NUM(nb-na+2:end);
end
[r,p,f2,e] = residuez(NUM,DEN,toler);

Method

The FIR part is first extracted, and the (strictly proper) remainder is passed to residuez for expansion of the IIR part (into a sum of complex resonators). One must remember that, in this case, the impulse-response of the IIR part $ R(z)$ begins after the impulse-response of the FIR part $ F(z)$ has finished, i.e.,

$\displaystyle H(z) = F(z) + z^{-{N_f}}R(z)
$

where $ N_f$ is the length of the FIR part (order of $ F(z)$ plus 1).

See §6.8.8 for an example usage of residued (with a comparison to residuez).


Next Section:
Parallel SOS to Transfer Function: psos2tf.m
Previous Section:
Partial Fraction Expansion: residuez.m