python中curve fit_scipy.optimize.curve_fit函数用法解析

在日常数据分析中,免不了要用到数据曲线拟合,而optimize.curve_fit()函数正好满足你的需求

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)

参数解析f 函数名

callable

The model function, f(x, …). It must take the independent variable as the first argument and the parameters to fit as separate remaining arguments.

简单来说就是需要拟合的好函数y,包括自变量x,参数A,B;

而curve_fit的主要功能就是计算A,B

#要拟合的一次函数

def f_1(x, A, B):

return A * x + Bxdata

array_like or objectThe independent variable where the data is measured. Should usually be an M-length sequence or an (k,M)-shaped array for functions with k predictors, but can actually be any object.

ydata

array_likeThe dependent data, a length M array - nominallyf(xdata,...).

p0

array_like , option

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值