I have a transfer function coefficients as following: [b,a] = ellip(4,.2,40,[.41 .47]);

I'd like to factor this system into its PFE using [r,p,k] = residue(b,a). Then, I'd like to implement a filter which uses a parallel combination of second-order subsections. To do this, I need to combine each complex pole with its complex conjugate so that the overall second order subsections will have real valued coefficients. Hence; I selected four pairs of first order terms and recombined them into second order subsections using "residue" function. How can I store the coefficients of the resulting second-order subsections in the matrices c and d so that each row corresponds to one second order system?

I tried to do this but I don't know whether it's correct or not?

[c1 d1]=residue([r(1) r(2)],[p(1) p(2)],0);
[c2 d2]=residue([r(3) r(4)],[p(3) p(4)],0);
[c3 d3]=residue([r(5) r(6)],[p(5) p(6)],0);
[c4 d4]=residue([r(7) r(8)],[p(7) p(8)],k);

[c d]=[c1 c2 c3 c4 d1 d2 d3 d4]

Can anybody please give me an idea? Any help would be appreciated

  • $\begingroup$ whoa! parallel, eh? uhm, you start with your transfer function that is a ratio of two polynomials a and b. then whatever polynomial is in the denominator (i guess it's a) is factored into roots that will include complex conjugate root pairs. then use Heaviside partial fraction expansion to get the parallel first-order sections. then combine each conjugate pole sections into a single second-order section. $\endgroup$ Commented Dec 3, 2019 at 7:02
  • $\begingroup$ Sir thank you but can you help me how to write the matlab code which produces the first order sections? $\endgroup$
    – Jason
    Commented Dec 3, 2019 at 8:01

1 Answer 1


A few points first

  1. Since you are using digital filters, you should be using residuez() not residue()
  2. Matlab's residuez() is not particularly well implemented: in case of higher order or steep filters, you can get a lot of numerically noise or results that are just totally wrong. Always check the result against your original target.

Back to the question: each residue comes as a conjugate complex pair (at least if you are lucky and don't have to deal with real or multiple poles). Just add these to form a single real second order section.

$$H(z) = \frac{r}{1-p \cdot z^{-1}} + \frac{r^{*}}{1-p^* \cdot z^{-1}} $$ $$= \frac{r \cdot (1-p^* \cdot z^{-1})+r^* \cdot (1-p^* \cdot z^{-1})}{(1-p \cdot z^{-1}) \cdot (1-p^* \cdot z^{-1})}$$

$$= \frac{(r + r^*) - (r \cdot p^* + r^* \cdot p ) \cdot z^{-1} }{1 -(p+p^*)\cdot z^{-1}+ p \cdot p^* \cdot z^{-2}}$$

The last equation gives you directly the real valued biquad coefficients (if I did the math correctly, that is).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.