Hello, guys.
I have a problem in fitting. Whenever I try to fit, I think it goes to local minimum. Also I saw the error messages which I couldn't fix properly. The message is: " The step size in the search has become less than the tolerance prescribed by the PrecisionGoal option, but the gradient is larger than the tolerance specified by the AccuracyGoal option. There is a possibility that the method has stalled at a point that is not a local minimum" Can you help me to get a global minimum ? Thank you very much.
The code that I used is following. And about the data file, I attached it.
dat = Import["d:\\Data\\P2d5Hs.txt", "Table"];
graph1 = ListPlot[dat, PlotRange -> All]
response[t_, x_, ?_, t0_, k1_, k2_, k3_, ?1_, ?2_, ?3_] :=
Exp[-(x - t + t0)^2/(?^2/2)] (
UnitStep[
x] {k1 (1 - Exp[-x/?1]) (Exp[-x/?2] +
Exp[-x/?3]) + k2 (1 - Exp[-x/?2]) +
k3 (1 - Exp[-x/?3])});
convol[t_, ?_, t0_, k1_, k2_,
k3_, ?1_, ?2_, ?3_] =
Integrate[
response[t, x, ?, t0, k1, k2,
k3, ?1, ?2, ?3], {x, -2, 13},
Assumptions -> {{t, ?, t0, k1, k2,
k3, ?1, ?2, ?3} ?
Reals, ? > 0 && ?1 > 0 && ?2 > 0 && ?3 >
0 && k2 > 0 && k3 > 0}];
sol = NonlinearModelFit[dat,
convol[t, ?, t0, k1, k2,
k3, ?1, ?2, ?3], {{t0, 0.05}, {?,
0.31}, {k1, 0.1}, {k2, 0.02}, {k3, 0.005}, {?1,
0.05}, {?2, 0.4}, {?3, 0.9}}, t,
ConfidenceLevel -> .998, MaxIterations -> 10000];
fitgraph = Table[{t, sol[t]}, {t, dat[[1, 1]], dat[[-1, 1]], 0.05}];
Show[graph1, Plot[sol[t], {t, -1.2, 13}, PlotRange -> All]]
sol["ParameterTable"]
sol["RSquared"]
Attachments: