[Date Index]
[Thread Index]
[Author Index]
Re: FindFit for a differential equation model with multiple variables
*To*: mathgroup at smc.vnet.net
*Subject*: [mg131747] Re: FindFit for a differential equation model with multiple variables
*From*: dantimatter <google at dantimatter.com>
*Date*: Fri, 27 Sep 2013 02:29:32 -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
*References*: <l0u02q$b3l$1@smc.vnet.net>
So it turns out that my institution has a certain amount of Mathematica technical support included in their license. I posed this question to the good people at Wolfram and this was their response:
"I've attached a notebook containing examples of how you might
successfully use FindFit with your parametric differential equation
system.
The notebook doesn't contain the results of the FindFit evaluations,
as they seemed to be taking a bit of time to evaluate. However, the
syntax and usage of all expressions in the notebook is correct as far
as I have tested and should give you a fit to your model."
The relevant contents of that notebook are:
ClearAll[DNA];
solutions =
ParametricNDSolve[
{Derivative[1, 0][MG][t, DNA] ==
a*DNA*NTP[t, DNA]/(Km1 + NTP[t, DNA]) - b*MG[t, DNA],
Derivative[1, 0][NTP][t, DNA] ==
-f*a*DNA*NTP[t, DNA]/(Km1 + NTP[t, DNA]) -
d*MG[t, DNA] NTP[t, DNA]/(Km2 + NTP[t, DNA]) -
c*NTP[t, DNA]/(Km3 + NTP[t, DNA]),
Derivative[1, 0][GFP][t, DNA] ==
g*d*MG[t, DNA] NTP[t, DNA]/(Km2 + NTP[t, DNA]),
NTP[0, DNA] == NTP0,
MG[0, DNA] == 0,
GFP[0, DNA] == 0},
{MG, NTP, GFP},
{t, 0, 800},
{DNA, 5, 10},(*
chosen as example domain *)
{a, b, c, d, f, g, Km1, Km2, Km3,
NTP0},
Method -> "StiffnessSwitching"
]
ClearAll[model];
model = MG /. solutions;
parameters = {a, b, c, d, f, g, Km1, Km2, Km3, NTP0};
startingValues = {6.8`, 0.012`, 247, 1.54`, 19.6`, 22.2`, 352200, 127882,
5134.5`, 611628};
(* quick test *)
model @@ startingValues
%[100, 7]
fit =
FindFit[
data,
{model[a, b, c, d, f, g, Km1, Km2, Km3, NTP0][t, DNA],
{a > 0, b > 0, c > 0,
d > 0, f > 0, g > 0,
Km1 > 1000, Km2 > 1000, Km3 > 1000,
NTP0 > 100000}},
Thread@{parameters, startingValues},
{t, DNA}
]
On Thursday, September 12, 2013 8:16:42 PM UTC-7, dantimatter wrote:
> 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: BitAnd[True,False]**
Next by Date:
**Re: combining FindFit and ParametricNDSolve?**
Previous by thread:
**FindFit for a differential equation model with multiple variables**
Next by thread:
**ReplacePart**
| |