Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: FindFit for a differential equation model with multiple variables
Replies: 1   Last Post: Sep 27, 2013 2:29 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dantimatter

Posts: 41
Registered: 11/30/07
FindFit for a differential equation model with multiple variables
Posted: Sep 12, 2013 11:16 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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!






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.