I believe I have encountered a case in Mathematica where the FindFit function is not able to capture the fitting parameter value even when the starting value is approximately equal to the best-fit paremeter value.
I have data I am trying to fit:
data = {{0., 1.}, {0.0001, 0.0946391}, {0.0002, 0.050354}, {0.0003,
0.034469}, {0.0004, 0.0262545}, {0.0005, 0.0212236}, {0.0006,
0.0178217}, {0.0007, 0.0153659}, {0.0008, 0.0135088}, {0.0009,
0.0120546}, {0.001, 0.0108848}, {0.0011, 0.00992321}, {0.0012,
0.00911858}, {0.0013, 0.00843532}, {0.0014, 0.00784783}, {0.0015,
0.00733724}, {0.0016, 0.00688935}, {0.0017, 0.00649325}, {0.0018,
0.00614043}, {0.0019, 0.00582415}, {0.002, 0.005539}, {0.0021,
0.00528059}, {0.0022, 0.00504532}, {0.0023, 0.00483021}, {0.0024,
0.00463277}, {0.0025, 0.0044509}, {0.0026, 0.00428282}, {0.0027,
0.00412703}, {0.0028, 0.00398222}, {0.0029, 0.00384727}, {0.003,
0.00372119}, {0.0031, 0.00360315}, {0.0032, 0.0034924}, {0.0033,
0.00338827}, {0.0034, 0.0032902}, {0.0035, 0.00319767}, {0.0036,
0.00311021}, {0.0037, 0.00302743}, {0.0038, 0.00294896}, {0.0039,
0.00287446}, {0.004, 0.00280365}, {0.0041, 0.00273626}, {0.0042,
0.00267204}, {0.0043, 0.00261077}, {0.0044, 0.00255226}, {0.0045,
0.00249633}, {0.0046, 0.0024428}, {0.0047, 0.00239152}, {0.0048,
0.00234236}, {0.0049, 0.00229519}, {0.005, 0.00224988}, {0.0051,
0.00220634}, {0.0052, 0.00216445}, {0.0053, 0.00212413}, {0.0054,
0.00208529}, {0.0055, 0.00204785}, {0.0056, 0.00201173}, {0.0057,
0.00197686}, {0.0058, 0.00194319}, {0.0059, 0.00191065}, {0.006,
0.00187919}, {0.0061, 0.00184874}, {0.0062, 0.00181927}, {0.0063,
0.00179073}, {0.0064, 0.00176307}, {0.0065, 0.00173626}, {0.0066,
0.00171025}, {0.0067, 0.00168501}, {0.0068, 0.00166051}, {0.0069,
0.00163671}, {0.007, 0.00161359}, {0.0071, 0.00159111}, {0.0072,
0.00156925}, {0.0073, 0.00154798}, {0.0074, 0.00152729}, {0.0075,
0.00150714}, {0.0076, 0.00148752}, {0.0077, 0.0014684}, {0.0078,
0.00144977}, {0.0079, 0.00143161}, {0.008, 0.0014139}, {0.0081,
0.00139662}, {0.0082, 0.00137976}, {0.0083, 0.00136331}, {0.0084,
0.00134724}, {0.0085, 0.00133155}, {0.0086, 0.00131622}, {0.0087,
0.00130124}, {0.0088, 0.0012866}, {0.0089, 0.00127228}, {0.009,
0.00125828}, {0.0091, 0.00124459}, {0.0092, 0.00123119}, {0.0093,
0.00121808}, {0.0094, 0.00120524}, {0.0095, 0.00119267}, {0.0096,
0.00118037}, {0.0097, 0.00116831}, {0.0098, 0.0011565}, {0.0099,
0.00114493}, {0.01, 0.00113358}}
This data, above, is basically a type of exponential decay with y-intercept at 1.
The fitting function I am using is:
fit[a_,T_] = 1/(1 + 9.58814*10^7 T^(3/2))
A quick plot of the data and the fitting function shows that the fitting parameter, a, should be relatively close to 2*10^-2
.
Show[
data,
Plot[
fit[0.02,T], {T, 0, 0.01},
PlotStyle -> Red
]
]
which gives
However, even when providing a starting value of 0.02 in the FindFit function, Mathematica is still not able to find a best-fit value...
FindFit[
data,
fit[a,T],
{
{a, 0.02}
},
T
][[1]]
which yields the error
FindFit::fmgz: Encountered a gradient that is effectively zero. The result returned may not be a minimum; it may be a maximum or a saddle point.
a -> 0.02
Is this a fundamental flaw in the fitting procedure used by FindFit, or is there something I'm neglecting to incorporate into the function FindFit?