美文网首页
python curve_fit

python curve_fit

作者: Aerosols | 来源:发表于2020-03-03 18:28 被阅读0次

拟合

import scipy  as spy
from scipy.optimize import curve_fit

def func_log(x,y0,A,x0,width):
    return   y0+A*np.exp(-(np.log(x/x0)/width)**2)

popt, pcov = curve_fit(func_log, x, y,bounds=([-1000.,0.,0.,0], [1000., 2000.,500,5])) 
yvals = func_log(x,*popt) #拟合y值

官方链接:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html
scipy.optimize.curve_fit(f, xdata, ydata, p0=None, sigma=None, absolute_sigma=False, check_finite=True, bounds=(-inf, inf), method=None, jac=None, **kwargs)[source]

相关文章

网友评论

      本文标题:python curve_fit

      本文链接:https://www.haomeiwen.com/subject/xulklhtx.html