I'm trying to have a curve fit that takes into account multiple series of y based on same values of x and same (exponential) law. The y values among the series vary a little since they're experimental but are still close (at same x).
I tried to build two arrays: one with the x and one with the two different series of y
def f(x,a,b,c):
return a*numpy.exp(-b*x)+c
xdata=numpy.array([data['x'],data['x']])
ydata = numpy.array([data['y1'], data['y2']])
popt, pcov=curve_fit(f,xdata,ydata)
But this error appears:
TypeError: Improper input: N=3 must not exceed M=2
Does anyone know how solve this error or a proper way to do this kind of curve fitting?