【发布时间】:2014-02-26 05:14:23
【问题描述】:
我尝试以数组 synthData[0,:]、synthData[1,:] 和 y 值 synthData[2,:] 的形式将函数拟合到来自矩阵 synthData 的数据。但是下面的 sn -p 返回“name 'args' not defined”
guess = [16.200000, -0.700000, 5.900000, -0.200000]
def func(x, a, b, c, d):
# fitter will understand that x[0] equiv. to synthData[:,0], etc.
return a + b*x[0] + c*x[1] + d*x[0]*x[1]
scipy.optimize.leastsq(func,guess,args(synthData,synthData[2,:]))
我已经摆弄它并在 SO 中搜索,但无法弄清楚它在做什么。
【问题讨论】:
标签: python scipy curve-fitting least-squares args