Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

filter frequency response curve fitting / optimization

Status
Not open for further replies.

GIORGI32

New Member
Hello

I have the frequency response of system A in 1/10 octave data point and I want to achieve a target frequency response by curve fitting / optimizing the parameters of a 2nd order low pass filter. In other words, I need to calculate the parameters of the 2nd order LPF which, when applied to the frequency response of system A, would be closest to the target frequency response I've defined.

I don't want to use software to do this. I actually want to figure out the math and create a C program to implement this function.

Can anyone suggest where I can find information that explains how I do this?
 
Hello there,


Do you have a particular topology in mind to work with or is that up for grabs too?

You dont have too much to optimize with only 2nd order, and usually you pick a certain type of known filter response based on your most important data points and go from there.
 
Last edited:
Thanks for your response MrAl. The filter topology is Sallen-Key. Agreed that there's not too much to optimize. Regardless, I'd like to automate the optimization.

It appears as though the Nelder–Mead/ downhill simplex/ or amoeba methods are the way to go. Still trying to learn how to apply them to what I need to do.
 
Hello again,


Well, second order SK is such a simple case for optimization i have to wonder, just a thought, did you try a more direct approach yet where you compute the amplitude from the transfer function and derive a polynomial (in w or perhaps w^2) where you could use a least squares fit then possibly calculate the values of the components from the resulting coefficients?
 
Hi again,

I suggested that because i am pretty sure the problem can be reduced before we even start and that reduces the complexity and thus makes a simpler and faster solution in the end. For example, since there is an over abundance of variables anyway setting R2=R1=R reduces the number of variables by 1 already. I suspect there are other simplifications too though but havent looked at it in detail yet.

There is also Marquardt Levenberg which like other solutions is an iterative method calculating a better and better estimate each time by calculating a new step s in each iteration. The whole process can be described in terms of matrices, which means the whole program would be simply calculating matrices and their inverses over and over again in order to obtain the new steps.
I've used this method (or a derivative) quite a bit in the past so i know first hand it works decently.

If you have ever used "Newtons Method" for one variable then you already have an idea how these methods work. They are basically very similar except they work with multivariate cases, and also include a damping factor to help aid convergence.

As a side note, there is also a bit written on what to do once a proposed fit is obtained. There is usually some analysis to try to determine if there exists any outliers or whatever, as well as if the proposed model truely looks suitable for the data set. There is also a bit written on how although exact convergence might not be obtained a set of solutions roughly the same lead to almost the same results anyway.

I might add that you can also change the fit criterion, from sum of squares to max absolute error value or whatever you think would work best for your application.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top