2
$\begingroup$

To model the frequency response of a system, I am looking for a method to fit the response of cascaded bi-quad filters to the response of that system using an optimization algorithm. The $S$-domain transfer function of the filter prototype to fit is:

$$ H(s)=\frac{w_0^{2N-1}(s+w_z)}{[s^2+(w_0/Q)s+w_0^2]^N} $$

This prototype utilizes a single identical $Q$ for all sections to keep the number of parameters as low as possible and avoid overfitting (so that the filter/model can easily be generalized without re-fitting).

The prototype can be decomposed into a cascade of $N-1$ 2nd-order lowpass and one 2nd-order bandpass section. For an order $N=4$ the decomposed transfer function can be written:

$$ H(s)=\frac{w_0^2}{s^2+(w_0/Q)s+w_0^2} \times \frac{w_0^2}{s^2+(w_0/Q)s+w_0^2} \times \frac{w_0^2}{s^2+(w_0/Q)s+w_0^2} \times \frac{w_0(s+w_z)}{s^2+(w_0/Q)s+w_0^2} $$

For example, an optimization algorithm could minimise some cost functions to find the best filter parameters ($Q$: quality factor, $N$: filter order, $w_0$: natural frequency, $w_Z$: ratio of $w_0$ determining the low frequency slope and $G$: filter gain) to fit the desired frequency response.

What would be a good method to determine the best parameters for the filter prototype to fit/model the wanted frequency response?

Thank you for your help.

PS: I wrote a previous post on a related problem, but the current question is better framed.

$\endgroup$

2 Answers 2

2
$\begingroup$

Instead of rebuilding your own methods (which you should do for sure at some moment), first start reviewing all the existing System Identification (Ref.Matlab, Ref.Python) and Filter Design (Ref.Matlab, Ref.Python) tools available, perhaps not in the same exact parametric shape, but dealing with the parameters, specifications and model structures you are showing in here, including, your SOS Sections Filter Structure.

NOte the tools available solves most and eventually more of the parameters you mentioned, i.e. cutoff frequencies, bandpass ripple, reject band ripple, and their tolerances, among other, which are much more obscure to develop.

$\endgroup$
2
$\begingroup$

What would be a good method to determine the best parameters for the filter prototype to fit/model the wanted frequency response?

It's a fairly standard non-linear optimization problem. Common solution for those is to define an error criteria, calculate the partial derivates of the error with respect to the model parameters and than use an iterative optimizer such as "steepest descent" or "conjugate gradient".

Whether this works well or not, depends a lot on your target. Your model is quite restrictive in it's topology and degree of freedoms and so there will be targets where it will fail miserably, since it's not a good fit.

The more standard methods work directly in the z-domain and use pole and zero locations as parameters. This allows allow possible filters to be solutions and your not constraining yourself to a specific filter topology.

$\endgroup$
4
  • $\begingroup$ Thank you for your answer. Yes, the topology is restrictive but supposed to provide a good basis for my target and allows to easily interpolate additional filters by only varying a single parameter. In the standard methods you are mentioning, how is the order of the filter chosen? Is it defined beforehand, or can it be one of the free parameters? Also where can I find literature about these methods? $\endgroup$
    – papaya
    Commented Apr 14, 2022 at 14:49
  • 1
    $\begingroup$ Order is a free parameter. You can pick one or try a few and see what is the best "bang for the buck". $\endgroup$
    – Hilmar
    Commented Apr 15, 2022 at 15:34
  • $\begingroup$ I see. Knowing that the order has to be an integer, is there a method to find it via optimisation? $\endgroup$
    – papaya
    Commented Apr 20, 2022 at 16:00
  • 1
    $\begingroup$ Sure. Good old trial-and-error works well here. You typically need the first 3 to 4 biquads to match the overall shape and any additional ones, will fit smaller and smaller wiggles in the target. I've yet to see a target that doesn't fit well with 16. $\endgroup$
    – Hilmar
    Commented Apr 20, 2022 at 20:29

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.