使用python绘制SN曲线(非线性回归模型)

问题描述 投票:0回答:1

输入数据和函数形式是已知的。您必须找出函数的系数。还需要确定这些系数的值(60.351、4.388、4.806)。在编写代码时,我受到了nonlinear-regression with python的启发唯一的区别是输入数据和功能定义。

xData = numpy.array([1, 23385, 35800, 63699, 106798, 222064, 4272000, 20296, 461351, 175300, 11815])
yData = numpy.array([198.9, 112.2, 100.3, 89.8, 80.3, 69.8, 60.8, 120.1, 65.3, 74.9, 127.7])


def func(x, a, b, Offset): # Sigmoid A With Offset from zunzun.com
    return  Offset + 139.0/ ((numpy.exp((log10(x))/a))**b)

我相信当我使用log10()函数时,初始参数存在一些问题。出现以下错误:error capture

python curve-fitting non-linear-regression sn
1个回答
0
投票

[经过几次搜索([StackOverFlow 1]之后,我重新定义了该函数:Offset + 139.0/ ((numpy.exp(np.log10(np.abs(x))/a))**b)非数字函数,例如math.log10()不能很好地与numpy数组一起使用]

© www.soinside.com 2019 - 2024. All rights reserved.