Assume that I have two functions describing one phenomena in the same range (x-axis). Both are sharing same parameters, but also can have their own. How can I fit them or minimize the errors to experimental data using SciPy or Lmfit >>AT ONCE<<? I think about something as below:
def f1(x_val, p1, p2, p3):
some_code_1
def f2(x_val, p1, p2, p4):
some_code_2
exp_data_1 = np.loadtxt("./mydata1.txt")
exp_data_x1 = exp_data_1[:,0]
exp_data_y1 = exp_data_1[:,1]
exp_data_2 = np.loadtxt("./mydata2.txt")
exp_data_x1 = exp_data_1[:,0]
exp_data_y1 = exp_data_1[:,1]
xxx = np.linspace(0, 1, 1000)
popt, pcov = curve_fit((f1,f2), (exp_data_y1, exp_data_y2), xxx)
And popt should contain only one set of parameters p1, p2, p3, p4, proper for both functions f1, f2. I will be very glad for any suggestions, hints. For more intuition is a problem with fitting the functions to hysteresis loop.
all the best