【发布时间】:2020-08-25 22:06:41
【问题描述】:
我正在使用 scipy.optimize 中的 curve_fit 来拟合我的数据。我有一个适合三个参数(Z1、Z2、Z3)的函数。我想提供界限。但是,我只想提供对 Z2 的限制(Z2 应低于 40)。我不想为 Z1 和 Z3 设置界限。那可能吗?
popt, pcov = curve_fit(func, xdata, ydata, p0 = [Z1, Z2, Z3],
bounds = ((10, 20, 5), (100, 50, 100,)))
# This way I provide bounds to Z1, Z2 and Z3
# I, however, only want to say that Z2 < 40
# Also interesting would be to say Z2 < Z1, with no bounds for Z1 or Z3
【问题讨论】:
标签: python scipy curve-fitting bounds