Difficulty Solving for parameters of a non-linear curve fit to data
6 views (last 30 days)
Show older comments
Hello,
I have a data set that I am attempting to describe with a certain nonlinear equation of the following form
Y=2*(C1*exp(C2*(x/C3 - 1))+P1*P2*exp(((x/C3)-P3)/P4)^2)/x;
This fit has been used to fit data of a similar nature previous times, not by me of course. So there are four unknown parameters. Amongst these parameters I know that P1 must vary between 0 and 1 and all other parameters must be greater than 0. In most cases when determining the parameters I make use of matlabs fminsearch built in function and it works well. Yet this time my fit is horrible. If someone could help me out a little bit I would much appreciate it.
Pat
4 Comments
Answers (2)
Shashank Prasanna
on 3 Sep 2013
FMINSEARCH like most optimization algorithms are sensitive to initial guess or starting point. Did you try to provide different starting points? FMINSEARCH does not allow you to specify bounds or constraints on your parameters which may allow you to get better results.
The Curve Fitting Toolbox provides routines to fit curves that are better suited for such problems than FMINSEARCH and allows bounds of parameters.
You can also employ the Global Optimization Toolbox routines if you are unable to find a good starting points. Again you can also specify constraints.
Please provide more information about why your "fit is horrible" with some reproduction code and examples and we can assist you further.
2 Comments
dpb
on 3 Sep 2013
Edited: dpb
on 4 Sep 2013
This is truly bizarro...that kind of double-valued response is expected????
What's actually independent/dependent variable? One would think the pressure would be dependent upon some diameter but plotted 't other way round?
Seems strange at best...
But the other comments still hold and I've got to run--maybe can look into it more later.
Matt J
on 4 Sep 2013
Edited: Matt J
on 4 Sep 2013
If you transform your data according to
XX = x/C3
YY = Y- 2*(C1*exp(C2*(x/C3 - 1))
then your model can be simplified to
YY= t1*exp((t2*XX-t3).^2)/XX
with unknown parameters t1,t2,t3. If you take the log() of both sides of this, you obtain quadratic equations parametrized by log(t1), t2, t3 which can be solved for e.g., using POLYFIT. I wouldn't recommend deriving final solutions for t1,t2,t3 only from that, but it might serve as a more educated initial guess (cf. Shashank's remarks) when fed to fminsearch, lsqcurvefit, fminbnd, etc... than what you are doing now.
In addition to LSQCURVEFIT, you could also try
which would let you take advantage of the fact that YY has a linear dependence on t1.
0 Comments
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!