[英]Fitting curve in python - fitting parameters
I am trying to fit a curve to my data in Python, as follows: 我正在尝试使曲线适合Python中的数据,如下所示:
def func(p1,p2,p3,x):
return p1*((p2-x)/p2)^(-p3)
And I call this function in an other function, and trying to fit: 我在另一个函数中调用此函数,并尝试拟合:
f1 = func(p1,p2,p3,x)
popt, pcov = curve_fit(f1, T, Susceptibility)
But Python doesn't regard p1,p2,p3
as a fitting parameter, becouse I get this error message: global name 'p1' is not defined
但是Python并未将p1,p2,p3
视为合适的参数,因为我收到此错误消息: global name 'p1' is not defined
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.