Re: Help getting values from NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg6826] Re: [mg6783] Help getting values from NDSolve
- From: penny at suu.edu (Des Penny)
- Date: Mon, 21 Apr 1997 02:03:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>I'm relatively new to Mathematica and need some help with the NDSolve >function. I have used it to solve an ordinary differential equation and got >the expected interpolating function which I then plotted. The plot is great >but I would like a list of coordinates so that I can analyze them further >and possibly import into a "prettier" graphing package. > >Any help would be appreciated. > >Please email and post (mosser at earthlink.net) Hi Chris: I decided to do some more work on this question. I was interested in pulling the data directly from the InterpolatingFunction. Here is my code. I've given it in expanded form so that the components would be easy to understand: sol=NDSolve[{y'[x]==y[x],y[0]==1},y,{x,0,2}]; fun= y /. sol; args=fun /. InterpolatingFunction->List; xvalues=args[[1,3,1]]; yvalues=Map[First,args[[1,4]]]; data=Transpose[{xvalues,yvalues}]; ListPlot[data] Hope this helps. Cheers, Des Penny ------------------------------- Des Penny Physical Science Dept. Southern Utah University Cedar City, UT 84720 VOICE: (Office): (801) 586-7708 (Home) : (801) 586-2286 FAX: (801) 865-8051 e-mail: penny at suu.edu -------------------------------