MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve and plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78953] Re: [mg78884] NDSolve and plots
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Fri, 13 Jul 2007 06:11:43 -0400 (EDT)
  • References: <2677133.1184257439073.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

If I could see your code, I could be more specific, but here's a similar 
situation, perhaps.

Use NDSolve:

s = First@
   NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2 x[t] - y[t]^3,
     x[0] == y[0] == 1}, {x, y}, {t, 20}]

{x->InterpolatingFunction[{{0.,20.}},<>],y->InterpolatingFunction[{{0.,20.}},<>]}

Save the interpolating functions:

Clear[f]
Table[f[i] = s[[i, 2]], {i, 1, Length@s}];

And here's a plot:

Plot[{f[1][t], f[2]@t}, {t, 0, 20}]

Doing the same thing with your problem would save 11 functions, f[1], .. .,  
f[11].

Bobby

On Thu, 12 Jul 2007 04:12:02 -0500, Nikhil Shankar  
<rise.of.aybabtu at gmail.com> 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.
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: integration of piecewise convex bivariate function with 6 parameters
  • Next by Date: Re: integration of piecewise convex bivariate function with 6 parameters
  • Previous by thread: Re: NDSolve and plots
  • Next by thread: Follow-up on StyleSheets in 6.0: Environment Specific Styles?