Hi,
Is it possible to use FindFit or similar functions to simultaneously fit multiple data sets. For example in the code below I have a model
that I want to fit to two sets of experimental data. Using Map I can individually use FindFit to fit each data set. However I am wondering
if it's possible to find one total set of best fit parameters for both data sets using these functions?
Procedurally, I would write a function that chooses a set of parameters and then measures the distance between the model and both data sets for that particular
parameter set. Is this possible with the built in functions?
Cheers!
texp = {0.2, 2.2, 4.0, 5.0, 6.0, 8.0, 11.0, 15.0, 18.0, 26.0, 33.0,
39.0, 45.0};
dexp = {35., 25., 22.1, 17.9, 16.8, 13.7, 12.4, 7.5, 4.9, 4.0, 2.4,
1.4, 1.1};
dt = Transpose[{texp, dexp}];
dt2 = Transpose[{texp, dexp - 0.75}];
model = ParametricNDSolveValue[{
A'[t] == -ka*A[t],
B'[t] == ka*A[t] - kb*B[t],
c'[t] == kb*B[t],
A[0] == 35.,
B[0] == 0.,
c[0] == 0.},
A,
{t, 0., 50.},
{ka, kb}]
Map[FindFit[#, model[ka, kb][t], {{ka, 0.1}, {kb, 0.2}}, t] &, {dt, dt2}]