I have a function of the form (y1,y2) = x*(a1,a2)+(b,b), where x, y1 and y2 are measured values and a1,a2 and b are the parameters I fit for. How can I do this in python? I tried using curve_fit like this:
x = np.array([1,2,3,4,5])
y = []
for i in range(len(x)):
y = y + [[1.2*x[i]+2,-2.2*x[i]+2]]
y = np.array(y)
def f(x,a,b,c):
return np.transpose(np.array([a*x+c,b*x+c]))
curve_fit(f,x,y)
but I am getting this error:
Result from function call is not a proper array of floats.