Re: Need help plotting multiple NDSolve solutions
- To: mathgroup@smc.vnet.net
- Subject: [mg10689] Re: Need help plotting multiple NDSolve solutions
- From: Norbert Scherm <scherm@irt.uni-hannover.de>
- Date: Fri, 30 Jan 1998 04:24:26 -0500
- Organization: Inst.f.Regelungstechnik Uni.-Hannover
- References: <6a1q24$q4n@smc.vnet.net>
Van Graves wrote: > > Hi, I'm a new Mathematica user and would like to plot a "family" of > solutions for a set of simultaneous differential equations using > multiple sets of initial conditions. I couldn't find an example in any > of the online documentation or on the Wolfram web site. Can anyone > give me an example of how to do this? Fortunately, these days I dealt with a similar problem (varying parameters of the ODE). ----------------------------------------------------------- dfeld={(* 0.001, 0.1, 0.2, 0.3,*) 0.4, 0.5, 0.6, 0.7, 0.8, 0.9(*, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0*)}; Clear[y,x,d,Te]; For[i=1,i<=Dimensions[dfeld][[1]],i++, Print[Dimensions[dfeld][[1]]-i]; d=dfeld[[i]]; Te=2.0*Pi*1.75; result= NDSolve[ {x''[t]+2*d*x'[t]+x[t]==1.0, x'[0]==0, x[0]==0 },x,{t,0,Te}]; y[i]=(x/.result)[[1]]; g[i]=Plot[Evaluate[x[t]/.result],{t,0.0,Te},DisplayFunction->Identity]; ]; Show[ Table[ g[i],{i,Dimensions[dfeld][[1]]} ], DisplayFunction->$DisplayFunction ] ----------------------------------------------------------- Instead of the parameter `d=dfeld[[i]]' you have to vary the initials in each iteration of the loop. I hope this helps... (Norbert)