2
$\begingroup$

I have to implement an IIR controller in dsPIC 33EP (16-bit, fixed-point, two's complement, wrap-around, 40-bit accumulator, 32-bit multiply, 12-bit ADC) and I am using cascaded, Direct Form I second order sections (ordering up).

Now, I am having trouble with the scaling procedure, since I'read a lot about $L^2$-norm, but can't quite figure out how to apply it properly.

When I get the sos matrix and gain using MATLAB (by either using tf2sos, fdatool, or filterbuilder) using $L^2$ norm, the gain values are always 1 for all of the intermediate sections.

  • Is this correct?
  • Or do I need to scale the input for each section?

(I have no experience implementing IIR systems and your help would mean a lot.)

Ben

$\endgroup$

1 Answer 1

2
$\begingroup$

The tf2sos function takes an input filter of order $N$, given by $H(z)=\frac{\sum_i^{N} b_iz^{-i}}{\sum_i^{N} a_iz^{-i}}$ and returns coefficients for $N/2$ second-order filters $H_k(z)=\frac{b_{k0}+b_{k1}z^{-1}+b_{k2}z^{-2}}{a_{k0}+a_{k1}z^{-1}+a_{k2}z^{-2}}$ and a gain $g$ such that

$$ H(z) = g \prod_kH_k(z) $$

So, regardless of what normalization you want from the function (none, inf or two), the above always holds. So to answer your questions:

  • the gain of each filter section is different (i.e. not necessarily one). (But, you dont care about that)
  • you do not need to adapt the gain between the filter stages. What comes out of the first stage is directly sent to the second stage. Then, after all stages were processed, you multiply the outcome of the last stage with $g$, what you receive from the tf2sos function.
$\endgroup$

Your Answer

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

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