Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 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

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!

Date Subject Author
9/12/13 dantimatter
9/27/13 dantimatter