Problem using nlinfit - poor fit

4 ビュー (過去 30 日間)
Armantas
Armantas 2014 年 8 月 14 日
回答済み: Star Strider 2014 年 8 月 14 日
Dear all,
I have a discrete dataset A(x,y), which I want to fit by a sum of 3 exponentials. My simple code:
par0=[-0.3 0.015 0.1 0.015 1.5e-08 3.8e-08 1.5e-08]; % initial parameter values
fit_par = nlinfit(x,y,@(par,x)(par(1)+par(2).*exp(x/par(5))+par(3).*exp(x/par(6))+par(4).*exp(x/par(7))),par0); % fitting
The fitting is not that great (attached) and I get the following error:
Warning: Some columns of the Jacobian are effectively zero at the solution, indicating that the model is insensitive to some of its parameters. That may
be because those parameters are not present in the model, or otherwise do not affect the predicted values. It may also be due to numerical underflow in
the model function, which can sometimes be avoided by choosing better initial parameter values, or by rescaling or recentering. Parameter estimates may
be unreliable.
Is it due to the very small x values I have or?
How can I get a good fit? Dataset A attached if you want to give it a try.
Thank you

採用された回答

Star Strider
Star Strider 2014 年 8 月 14 日
One problem is scaling the x values, because they are close to floating point precision. Plotting your data and the fit on a linear rather than logarithmic x-scale also suggests an appropriate model. I multiplied the x values by 1E+9, and was able to get a decent fit with a single-exponential:
eqn = @(par,x) par(1) - par(2).*exp(x/par(3));
that after some experimenting, yielded:
fit_par =
268.8501e-006 248.9514e-006 -561.3801e-003
The actual value of fit_par(3) would then be -561.3801e-012.
A two- or three-exponential model may be difficult to fit, so I would experiment by successively subtracting two-parameter exponential terms similar to the initial term (with those initial parameter estimates for the initial set).
Since this appears to be an heuristic exercise, I also suggest using nlparci at this three-parameter and each subsequent step (sequential subtraction of two-parameter exponential terms). While you get a good fit and the confidence intervals remain significant (bounds do not include zero), continue adding to the third set of exponential terms. If at any step any bounds include zero, the model is over-parameterised and does not represent your data. You would then have to accept a simpler model.

その他の回答 (0 件)

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by