为什么我在 Mathematica 中拟合的非线性模型不提供小数字?

Why is my nonlinear model fitting in mathematica not providing small figures?

#dataset, sigmoidal curve
ratio278a267 ={{5.445, 0.0501}, {6.177, 0.035}, {7., 0.0589}, {7.368, 
  0.0953}, {7.73, 0.1419}, {8.169, 1.0697}, {9.141, 1.0869}, {10.3, 
  1.0981}} 

#nonlinearmodelfitting for dataset
fit = FindFit[ratio278a267, (1/(a + (E^(-b*(x - c))))), {a, b, c}, x]
fit2 = NonlinearModelFit[
   ratio278a267, (1/(a + (E^(-b*(x - c))))), {a, b, c}, x]["RSquared"]

#fit1 & fit2 output respectively
output:
{a -> 0.639719, b -> -250.201, c -> -1008.92}
0.

上面的代码是我在 Mathematica 中用于非线性拟合的代码,输出没有提供相当小的数字,尽管我已经在覆盖在我的数据集上的图形计算器中绘制了它,数字在 0-10 之间对于a,b,c都得到了合理的拟合

使 FindFit 收敛于一个好的解决方案的一种方法是为其提供良好的起始值,特别是当您的模型可能对某些值的拟合非常差时。

x=.;a=.;b=.;c=.;
ratio278a267 ={{5.445, 0.0501}, {6.177, 0.035}, {7., 0.0589}, {7.368,0.0953},
  {7.73, 0.1419}, {8.169, 1.0697}, {9.141, 1.0869}, {10.3,1.0981}};
fit = FindFit[ratio278a267, (1/(a+(E^(-b*(x-c))))), {{a,0.92}, {b,8.7}, {c,7.9}}, x]
Show[ListPlot[ratio278a267],Plot[(1/(a+(E^(-b*(x-c)))))/.fit,{x,5.445,10.3}]]

在这个例子中,我通过进行一万次 Monte Carlo 试验来寻找模型和数据点之间的最小平方误差总和,然后让 FindFit 收敛于最佳值它可以找到的值。