I'm currently working on a project where I'm implementing different filter types (e.g. iirs - direct form 1, 2, transposed 1, 2, etc.). I just recently started attempting to implement a second order section filter. This filter is made up of a cascade of biquad filters each implemented as transposed direct form 2 stages.

After implementing this, I wanted to verify that my results matched those in MATLAB. I opened up the filter design toolkit and generated an 8th order SOS filter. When I exported this filter, it exports both a SOS matrix along with a scaling array G.

So my question: Why does MATLAB provide this scaling array G? Shouldn't the SOS matrix be fully capable of describing the filter by itself? Why does MATLAB decide to factor out these gains?

Is this just a courtesy of MATLAB, such that the user can 'fine tune' each filter stage gain to determine the best option?


1 Answer 1


Of course an SOS matrix is capable of completely describing the filter including the gain. However, in the Matlab SOS matrix the $b_0$ coefficients are all equal to $1$ by default (if no extra scaling is used), which is a kind of "neutral" scaling (and gets rid of one multiplication per second-order section). The gain factor $G$ is the overall gain necessary to describe the filter in addition to that scaled SOS matrix.

Note that for fixed-point implementations each second-order section should be scaled individually. This can be done with different goals in mind, e.g., to minimize the probability of overflow, or to minimize the quantization noise.

  • $\begingroup$ You say 'gain factor G' as if it's a single number, but MATLAB produces a gain vector (which I assume is a gain for each stage). I assume these gains are separated based on your second comment, however, how does MATLAB automatically generate these coefficients? i.e. Why/how does it weight them the way it does? $\endgroup$
    – Izzo
    Commented Dec 5, 2016 at 22:49

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.