I have a bunch of data, and I want a fitting with a function that I want, for example, 1/(ax^2+bx+c). My objective is to get a,b,c values.
Is there any function of MATLAB that helps with this? I have been checking the fit() function, but I didn’t reach a conclusion. Which is the best way?
The model you give can be solved using simple methods:
Result:
This is possible because the model you give is a linear one, in which case the backslash operator will give the solution (the
1./yis a bit dangerous though…)When fitting non-linear models, take a look at
lsqcurvefit(optimization toolbox), or you can write your own implementation usingfmincon(optimization toolbox),fminsearchorfminunc.Also, if you happen to have the curve fitting toolbox, type
help curvefitand start there.