Message Boards Message Boards

0
|
12151 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Simultaneously Fit Multiple Data Sets

Posted 11 years ago
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}]
POSTED BY: Pat Mac
3 Replies
Posted 11 years ago
Great,

Thanks for the suggestions!
POSTED BY: Pat Mac
Popular question.  See   http://community.wolfram.com/groups/-/m/t/135933
and links therein for more suggestions.
POSTED BY: Bruce Miller
Hi Pat,

I had a similar problem some time ago. The best way to do what you want to do I think is the following. Do data=Join[dt,dt2] but here dt2 is not your dt2 original data, do a shift (for instance add 100) on the texp data which enters into the dt2 data. Then define a new model through the command NewModel[t_]:=If[texp<100,model,model[t-100]]. Thus FindFit[data,NewModel,{ka,kb},t]. Initial conditions for the parameters is up to you (recommendable).

Regards
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract