# What is the source of error in the following fitting procedure in Mathematica 8.0? [closed]

I am trying to fit the following data with a user-defined model. A priori, we know that this model is supposed to be the best fit for the given data. But, I do not know why I am receiving many error messages. Decent values for the parameters 1, 2 and 3 are respectively known to be in the range (10,11), (-1,-30) and (-1,-3). Your help is appreciated.

h=0.7;
data = {{7.558 - Log10[h], Log[10]*10^-0.89613}, {7.7029 - Log10[h], Log[10]*10^-1.0998}, {7.8551 - Log10[h], Log[10]*10^-1.0591}, {8.0145 - Log10[h], Log[10]*10^-1.2016}, {8.1522 - Log10[h], Log[10]*10^-1.3442}, {8.3043 - Log10[h], Log[10]*10^-1.3136}, {8.4783 - Log10[h], Log[10]*10^-1.334}, {8.6232 - Log10[h], Log[10]*10^-1.3136}, {8.7536 - Log10[h], Log[10]*10^-1.3035}, {8.9058 - Log10[h], Log[10]*10^-1.446}, {9.058 - Log10[h], Log[10]*10^-1.558}, {9.1957 - Log10[h], Log[10]*10^-1.5479}, {9.3478 - Log10[h], Log[10]*10^-1.6802}, {9.5072 - Log10[h], Log[10]*10^-1.7312}, {9.6594 - Log10[h], Log[10]*10^-1.8432}, {9.8043 - Log10[h], Log[10]*10^-1.9756}, {9.9565 - Log10[h], Log[10]*10^-2.169}, {10.101 - Log10[h], Log[10]*10^-2.4033}, {10.246 - Log10[h], Log[10]*10^-2.7902}, {10.399 - Log10[h], Log[10]*10^-3.0244}, {10.543 - Log10[h], Log[10]*10^-3.4216}, {10.688 - Log10[h], Log[10]*10^-4.0631}, {10.848 - Log10[h], Log[10]*10^-4.8473}};
model = Log[10]*Exp[-10^(x - Log10[h] - par1)]*10^par2*(10^(x - Log10[h] - par1))^(par3 + 1);
curve = FindFit[data, model, {par1, par2, par3}, x]


During evaluation of In[175]:= General::unfl: Underflow occurred in computation. >>

During evaluation of In[175]:= General::unfl: Underflow occurred in computation. >>

During evaluation of In[175]:= General::unfl: Underflow occurred in computation. >>

During evaluation of In[175]:= General::stop: Further output of General::unfl will be suppressed during this calculation. >>

During evaluation of In[175]:= 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. >>

Out[177]= {par1 -> 1., par2 -> 1., par3 -> 1.}

• I can't reproduce the underflow errors, but I do also receive the zero-gradient one. FindFit will automatically start with the parameters set to $1$, but you should probably provide better starting values for your parameters. – MarcoB Jun 30 '16 at 18:45
• How can I do that? I kind of know what are decent values for three parameters. – Benjamin Jun 30 '16 at 18:47
• You can use a parameter specification of the form: {{par1, ...}, {par2, ...}, {par3, ...}} within FindFit or NonlinearModelFit; substitute appropriate starting values where I left .... – MarcoB Jun 30 '16 at 18:50
• only NonlinearModelFit worked. Thanks, – Benjamin Jun 30 '16 at 18:57

curve = FindFit[data, model, {{par1, 10}, {par2, -2}, {par3, -1}}, x]