Я пытаюсь подогнать кривую к некоторым точкам.
### Analysis: cost function
md = 215 / 0.89
wl = [0, 0.5, 1, 1.5, 2, 3, 4, 5, 6]
d = [0, 0.49, 0.71, 0.84, 0.95, 0.98, 1.0, 1.0, 1.0]
dr = []
for i in d: dr.append(i*md)
f, ax = plt.subplots(figsize=(9.5, 6.5))
ax = setFont(ax, 'Arial', 14)
ax.plot(wl, dr, lw=2)
grid()
Это типичная логистическая функция. Это то, что я делаю
from scipy.optimize import curve_fit
def func(t,alpha, a):
return 241.573 / 1+ (a * np.exp(alpha * t))
# coefficients and curve fit for curve
popt, pcov = curve_fit(func, wl, dr)
alpha, a = popt
v_fit = func(wl, alpha, a)
Но я получаю ошибку
TypeError: can't multiply sequence by non-int of type 'numpy.float64'