Difficulty Solving for parameters of a non-linear curve fit to data
이전 댓글 표시
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
dpb
2013년 9월 3일
Well, there are seven separate constants as written unless C1-C4 are known.
Even assuming that, P1*P2 is just one constant and the two are indeterminate entirely so at least give fminsearch some help and write only one. If there's some reason to partition the value into some relative ratio later, that can be done after the fact.
Then it all comes down to the number of observations and the quality of the data vis a vis the assumed functional form -- no info on that was given.
fminzero doesn't include bounded optimization; lsqnonlin from the Optimization Toolbox does. What is on the FEX for nonlinear fitting w/ bounds on parameters I've not checked.
Patrick
2013년 9월 3일
Patrick
2013년 9월 3일
Patrick
2013년 9월 3일
답변 (2개)
Shashank Prasanna
2013년 9월 3일
0 개 추천
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
Patrick
2013년 9월 3일
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.
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.
카테고리
도움말 센터 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!