我试图拟合呈指数递减的数据。如果我使用cftools
来拟合单项指数函数,那我就很合适。然而,当我尝试使用fit
功能:指数拟合和cftools在Matlab中给出不同的结果
f = fit(x, y, 'exp1');
它给了我下面的错误:
Warning: NaN, Inf, or complex value detected in startpoint;
choosing random starting point instead.
> In curvefit.attention.Warning/throw (line 30)
In fit>iFit (line 299)
In fit (line 108)
和系数它给最终会被垃圾。
我以为cftools
正在运行fit
。为什么有差异?我如何从脚本运行cftools
?
没有数据可能很难猜测。您*可以*查看“File> Generate Code”下的'cftool'使用的代码。看起来有一个区别可能是'cftool'为你选择了初始值。您可以使用'fitoptions(model)'检查拟合模型的选项。 – alexforrence