Curve fit an exponential decay function in Python using given data points
问题 With the curve_fit function in SciPy I'm able to determine the coefficients that represent the curve shown in the plot below. def func2(t, tau): return np.exp(-t / tau) t2 = np.linspace(0, 4, 50) y2 = func2(t2, 1.2) y2_noise = 0.2 * np.random.normal(size=t2.size) y2_curve_noise = y2 + y2_noise popt2, pcov2 = curve_fit(func2, t2, y2_curve_noise) tau2, = popt2 y2_fit = func2(t2, tau2) I would like to use a similar function to represent some data points. However, I'm unable to use this approach