Question about adding events to ndsolve
- To: mathgroup at smc.vnet.net
- Subject: [mg120337] Question about adding events to ndsolve
- From: Chrisantha Fernando <ctf20 at sussex.ac.uk>
- Date: Tue, 19 Jul 2011 06:57:30 -0400 (EDT)
Please help with adding events to ndsolve. I need to change the
concentrations discretely at certain points in time.
s = NDSolve[{Derivative[1][X0][t] == 0, Derivative[1][X1][t] ==
0,
Derivative[1][X3][t] ==
6.088416` X1[t] X4[t] - 0.000723` X3[t] X4[t] + 7.721115` X1[t]
X7[t] -
9.366268` X3[t] X8[t],
Derivative[1][X4][t] == -30.` X0[t] X4[t] + 0.031364` X7[t]
X8[t],
Derivative[1][X7][t] ==
30.` X0[t] X4[t] - 7.721115` X1[t] X7[t] + 9.366268` X3[t] X8[t] -
0.031364` X7[t] X8[t],
Derivative[1][X8][t] ==
30.` X0[t] X4[t] + 7.721115` X1[t] X7[t] - 9.366268` X3[t] X8[t] -
0.031364` X7[t] X8[t], X0[0] == 0.`, X1[0] == 0.`, X3[0] ==
1,
X4[0] == 1, X7[0] == 1, X8[0] == 1}, {X0, X1, X3, X4, X7,
X8}, {t, 0, 30}]
Plot[Evaluate[{X1[x], X2[x], X3[x], X4[x], X7[x], X8[x]} /. s], {x,
0,
30}, PlotRange -> All]
and I'd like to add events such that at specific points in time I can
change the values of the variables (chemicals) to a value that I set
externally, i.e. these will be external stimuli to the ODEs that change
the concentrations of chemicals discretely.
Cheers,
Chrisantha