Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x scipy.optimize.curve_与条件拟合_Python 3.x_Scipy_Scipy Optimize - Fatal编程技术网

Python 3.x scipy.optimize.curve_与条件拟合

Python 3.x scipy.optimize.curve_与条件拟合,python-3.x,scipy,scipy-optimize,Python 3.x,Scipy,Scipy Optimize,我使用Python+NumPy+SciPy来根据数据确定方程的系数。方程式定义如下: def func (x, a,b,c,d): if x < d: return 0 else: return a * ( 1 - np.exp( - b * (x - c) ** d) 它工作正常,因为x

我使用Python+NumPy+SciPy来根据数据确定方程的系数。方程式定义如下:

def func (x, a,b,c,d):
    if x < d:
        return 0
    else:
        return a * ( 1 - np.exp( - b * (x - c) ** d)
它工作正常,因为
x
的值范围是由条件定义的, 但是有没有更好的方法呢


理想情况下,make甚至可以阻止计算
a*(1-np.exp(-b*(x-c)**d)

def func (x, a,b,c,d):
    return np.where ( x < c,
        0 ,
        a * ( 1 - np.exp( - b * (x - c) ** d) )
    )
def func (x, a,b,c,d):
    return np.where ( x < c,
        0 ,
        a * ( 1 - np.exp( - b * np.abs( x - c) ** d) )
    )