📜  最小二乘拟合直线python代码示例

📅  最后修改于: 2022-03-11 14:45:33.344000             🧑  作者: Mango

代码示例1
from scipy.optimize import curve_fit

def f(x, A, B): # this is your 'straight line' y=f(x)
    return A*x + B

popt, pcov = curve_fit(f, x, y) # your data x, y to fit