Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

FindFit for a differential equation model with multiple variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131630] FindFit for a differential equation model with multiple variables
  • From: dantimatter <google at dantimatter.com>
  • Date: Fri, 13 Sep 2013 00:36:55 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Hello All

I'm trying to figure out how to use FindFit with a multivariable differential equation model and data.  I've successfully made it work for the one-variable version of the model by following the example on the Help page:

%%%%%%%%%%%%%%%%%%%

X_const = 10;

model[a_?NumberQ, b_?NumberQ, c_?NumberQ, Km_?NumberQ, NTP0_?NumberQ] := 
(model[a, b, c, Km, NTP0] = 
    First[MG /. 
      NDSolve[{MG'[t] == a*X_const*NTP[t]/(Km + NTP[t]) - b MG[t], 
        NTP'[t] == -a*X_const*NTP[t]/(Km + NTP[t]) - Exp[c] NTP[t], 
        NTP[0] == NTP0, MG[0] == 0}, {MG, NTP}, {t, 0, 800}]]);

fit = FindFit[data, 
  model[a, b, c, Km, NTP0][t], {{a, 20}, {b, .017}, {c, -3}, {Km, 5000}, {NTP0, 15000}}, t]

%%%%%%%%%%%%%%%%%%%

where the data looks like:

data = {{1.65, 111}, {4.65, 141}, {7.65, 130}, {10.65, 247}, {13.65, 
  301}, {16.65, 395}, {19.65, 444}, {22.65, 652}, ...};

But now I'd like to do it with 'X_const' being an additional variable included in the data like:

newdata = {{1.65, 10, 111}, {4.65, 10, 141}, {7.65, 10, 130}, ..., {1.65, 5, -4}, {4.65, 5, 118}, {7.65, 5, 86}, {10.65, 5, 85}, {13.65, 5, 110}, ...};

I imagine that this is something that's possible, but I'm not sure on the syntax.  Anyone have any thoughts on this? 

Many thanks!





  • Prev by Date: Re: producing a noise
  • Next by Date: ReplacePart
  • Previous by thread: fit timeseries with gaussian mixture distribution
  • Next by thread: Re: FindFit for a differential equation model with multiple variables