使用lsqcurvefit的Matlab拟合错误

Matlab fitting error using lsqcurvefit

我正在开发代码以使 Gompertz 方程适合细菌生长曲线,并使用以下网站提供的一些示例数据进行练习:

http://www.math.tamu.edu/~phoward/m442/ia3sol.pdf

根据此代码,拟合应该几乎与数据匹配(图表在上面的网页第 3 页给出)。然而,当我 运行 代码时,实际数据绘制正确,但 lsqcurve 拟合非常差,并给出以下消息:

Local minimum possible.

lsqcurvefit stopped because the size of the current step is less than
the default value of the step size tolerance.

我做错了什么吗?

感谢您的宝贵时间,

劳拉

问题出在链接document.

Gompertz 函数的参数化方式如下:

%with parameters p(1) = K and p(2) = initial population
%p(3) = r.
V = p(1).*(p(2)/p(1)).^exp(-p(3)*t);

但是,曲线拟合的初始参数是针对 p 向量中的不同参数顺序给出的([r, K, p0] 而不是 [K, p0, r])。而且,结果向量在文档中也乱七八糟

通过将 p0 更改为此 [1000, 3.93, 0.01],曲线拟合将会收敛,您将得到一个很好的拟合: