So based on the answer given to the question [python nonlinear least squares fitting
I adapted the answer to estimate the three parameters kd,p0,l0
N = 10
kd_guess = 7.0 # <-- You have to supply a guess for kd
p0_guess = 8.0
l0_guess = 15.0
p0 = np.linspace(0,10,N)
l0 = np.linspace(0,10,N)
PLP = func(4.0,5.0,6.0)+(np.random.random(N)-0.5)*2.0
# The target should be (4.0,5.0,6.0)
kd,p0,l0,cov = scp.optimize.leastsq(residuals,[kd_guess,p0_guess,l0_guess,PLP])
I would like to avoid the following error,
Traceback (most recent call last):
File "Main.py", line 40, in <module>
kd,p0,l0,cov = scp.optimize.leastsq(residuals,[kd_guess,p0_guess,l0_guess,PLP])
File "/home/arvaldez/anaconda3/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 380, in leastsq
x0 = asarray(x0).flatten()
File "/home/arvaldez/anaconda3/lib/python3.6/site-packages/numpy/core/numeric.py", line 501, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.