Re: Solving Simultaneous Differential Equations
- To: mathgroup at smc.vnet.net
- Subject: [mg78926] Re: Solving Simultaneous Differential Equations
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 13 Jul 2007 05:57:33 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f74rj2$80f$1@smc.vnet.net>
Nikhil Shankar wrote: > Hey guys, > > I'm working on a model of the heart, which can be simplified to eleven simultaneous differential equations... I am solving them all with NDSolve and explicit Runge Kutta numerical integration. I am happy with the results, but I don't know how to plot a single function, of the eleven that are solved simultaneously. > > I can plot all 11 of them on one graph by using > > Plot[Evaluate[eqs /. %], {t, 0, 10}] > > where eqs are all 11 functions, and the last output was the set of the 11 interpolating functions. Plotting all 11 pretty much has no value to me though. > > How do I store the interpolating function data for each function so I can plot each by itself? > > Also, how can I save step-by-step results using Reap/Sow? > > Thanks for your help guys. > Since you did not provide any example, I can only guess what naming convention you used. The following should help you started. In[1]:= sols = NDSolve[{Derivative[1][x][t] == -y[t] - x[t]^2, Derivative[1][y][t] == 2*x[t] - y[t]^3, x[0] == y[0] == 1}, {x, y}, {t, 20}] Plot[Evaluate[{x[t], y[t]} /. sols], {t, 0, 20}] Plot[Evaluate[{x[t]} /. sols], {t, 0, 20}] Plot[Evaluate[{y[t]} /. sols], {t, 0, 20}] Out[1]= {{x\[Rule]InterpolatingFunction[{{0.,20.}},<>],y\[Rule]InterpolatingFunction[{\ {0.,20.}},<>]}} Out[2]= â??Graphicsâ?? Out[3]= â??Graphicsâ?? Out[4]= â??Graphicsâ?? Regards, Jean-Marc