I want to fit a given data using the approach developed by @Bob Hanlon here: Fit and find fitting parameters of data given an equation
I have tried this approach for several different data sets but I have one in particular where the equation does not seem to fit the data very well but it is not very clear to me why or if I can "tweak the equation" or the parameters to make it fit well.
Here's the my data and the code I am using:
hey = {{-2.`, 0.3650687761296365`}, {-1.5228787452803376`,
0.35024185145494713`}, {-1.`,
0.35008362652827657`}, {-0.5228787452803376`,
0.35002569469868255`}, {-4.821637332766436`*^-17,
0.3690654823479624`}, {0.4771212547196624`,
0.4295109082336017`}, {1.`,
0.5336781026939912`}, {1.4771212547196624`,
0.7942359842488445`}, {2.`,
1.3736241822734323`}, {2.4771212547196626`,
2.0178692522958217`}, {3.`,
2.2855926539783797`}, {3.477121254719662`,
2.2855974030998034`}, {4.`, 2.2855975424841546`}}
(nlmp = NonlinearModelFit[
hey, {2.2856 (1 - Exp[-(10^logt/tauc)^bc]), bc <= 1}, {tauc, bc},
logt]) // Normal
nlmp["BestFitParameters"]
Show[
ListPlot[hey, PlotMarkers -> {Automatic, 13}, AspectRatio -> 1 ,
Frame -> True, PlotRange -> All, Axes -> False, ImageSize -> Medium,
AspectRatio -> 1, FrameStyle -> Directive[Black, 13],
FrameLabel -> {Style["Log (\!\(\*SubscriptBox[\(t\), \(a\)]\) / s)",
16],
Style["\[CapitalDelta]H (\!\(\*SuperscriptBox[\(Jg\), \(-1\)]\))",
16]}, PlotLabel -> Style[Ta[[8 + 1]] "ºC", Black, 14]],
Plot[nlmp[logt], {logt, -2.2, 4.2}, PlotRange -> All,
AspectRatio -> 1, Frame -> True, Axes -> False, AspectRatio -> 1,
FrameStyle -> Directive[Black, 13],
FrameLabel -> {Style["Log (\!\(\*SubscriptBox[\(t\), \(a\)]\) / s)",
16], Style[
"\!\(\*SubscriptBox[\(\[CapitalDelta]H\), \(a\)]\) (J/g)", 16]},
Epilog -> {Red, AbsolutePointSize[4], Point[datac]}]
]
Which gives the following fit:
I have also tried simply using
(nlmp = NonlinearModelFit[hey, {2.2856 (1 - Exp[-(10^logt/tauc)^bc])**+ 0.35**, bc <= 1}, {tauc, bc},logt]) // Normal
and it of course fixes the fit in the bottom part but now the problem is in the upper part.
Question:
What is wrong with this particular data set and How could I modified the equation to make a correct fit (the lower part of the data is not correctly fitted)?
For reference, the fitting equation that I am using in nlmp
is:
(nlmp = NonlinearModelFit[hey, {2.2856 (1 - Exp[-(10^logt/tauc)^bc])**+ 0.35**, bc <= 1}, {tauc, bc},logt]) // Normal
and it fixes the bottom part but now the upper part is wrong. There must be a very simple combination where it can fit it completely, no?. I guess in my case, there is no need for that to have a physical meaning $\endgroup$delHinf
the asymptotic behavior would beHa == offset + (delHinf - offset) (1 - Exp[-(10^logt/tauc)^bc])
$\endgroup$delHinf
. Thanks again for your help ! $\endgroup$