How to apply the gain factor G to SOS coefficients when designing a IIR filter on sptool (MATLAB)? After designing an IIR filter on sptool, I export the coefficients (SOS) and gain (G) into a .mat file. When filtering, we can use sosfilt(SOS, x), which results in the correct output but with the wrong scaling. I guess this is what the gain variable G is for, but the documentation of sosfilt() never mentions this.
The impulse response of the filter has values of several powers of ten (~10^16), whereas in sptool it had very small coefficients (&lt; 1).
How is one supposed to use the SOS and G variables when exported from sptool, to correctly scale the weights of the exported IIR filter?
The easiest way would be
y = prod(G)*sosfilt(SOS,x);

An alternative would be put to the cumulative gain into the first section.
sosScaled = SOS;
sosScaled(1,1:3) = sosScaled(1,1:3)*prod(G);
y = sosfilt(sosScaled,x);