How do I best fit a function's parameters to a curve

AI Thread Summary
To fit the parameters C1 to C4 of the function f=C1 + C2/((C3-X)^C4) to a curve representing a data set resembling a half ellipse, a least-squares fitting approach is suggested. The user inquires about using Matlab for this optimization, seeking a function that can directly compute the best fit parameters from the data set. They mention the possibility of first fitting a polynomial or Gaussian to the data and then comparing Fourier series, but are looking for a more efficient solution. Resources from MathWorks are provided to assist with the least-squares fitting process. The goal is to effectively utilize the specified function to accurately describe the dataset.
rsr_life
Messages
48
Reaction score
0
Hello,

Suppose,
1. I have a function f=C1 + C2/((C3-X)^C4); where Cn is a constant;
I'm looking at the Havriliak-Negami equation which has some 5 constants.

2. I have a data set whose least-squares fit looks like a curve,

How can I compute the values of the function's parameters C1 to C4 that would best fit this function 1 to the curve?

One idea I had was to do a separate curve fitting for the data set (using a polynomial or a set of gaussians), then take the Fourier series of that resulting fitting function; compare those terms to the Fourier series of this function f, and solve any resulting equations containing C1 to C4.

But I bet there's some Matlab function that does this job better if I simply supply the data set and the function? i.e. it optimizes the functions parameters to get me the best least squares fit to the data set?

Any help with Matlab or pointers to this is appreciated!

Many thanks.
 
Engineering news on Phys.org
Last edited by a moderator:
Ok. A fit of the function I described to any curve that would best cover the data set I have.

The data set, when plotted, looks like a half ellipse (and is independent of the function).

I need to find the values of the the function's parameters C1 to C4 that would best fit this curve. There are other functions too that could describe this dataset, but I need to compute how I could specifically use this function to describe them.

Thank you!
 
Those links I gave you should help with what you want.
 
I have Mass A being pulled vertically. I have Mass B on an incline that is pulling Mass A. There is a 2:1 pulley between them. The math I'm using is: FA = MA / 2 = ? t-force MB * SIN(of the incline degree) = ? If MB is greater then FA, it pulls FA up as MB moves down the incline. BUT... If I reverse the 2:1 pulley. Then the math changes to... FA = MA * 2 = ? t-force MB * SIN(of the incline degree) = ? If FA is greater then MB, it pulls MB up the incline as FA moves down. It's confusing...
Back
Top