Re: Multiple Executions of .nb file part2
- To: mathgroup at smc.vnet.net
- Subject: [mg90518] Re: Multiple Executions of .nb file part2
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 11 Jul 2008 02:05:56 -0400 (EDT)
- Organization: Uni Leipzig
- References: <g54op3$f50$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, > fun[]:= (SmV; > > ***code*** > > ) > cant't work but fun[SmV_]:=Module[{your local variables except SmV},***code***] may be. Regards Jens Dave wrote: > Hi, > > I think I maybe over simplified my situation. My project uses a series of > nested differential equations. These run over a given time and then print > either a graph or the plot points or both (depending on my needs). > > An example of the code is: > > **************************** > > > Off[General::spell] > > time = 500; > > SmV = -80; > > > > PD2mnax0[PD2u_] := 1/(1 + Exp[-(PD2u + 24.7)/5.29]); > > PD2hnax0[PD2u_] := 1/(1 + Exp[(PD2u + 48.9)/5.18]); > > PD2mk10x[PD2u_] := 1/(1 + Exp[-(PD2u + 14.2)/11.8]); > > PD2taumnax[PD2u_] := 1.32 - 1.26/(1 + Exp[-(PD2u + 120)/25]); > > PD2tauhnax[PD2u_] := (0.67/(1 + Exp[-(PD2u + 62.9)/10]))*(1.5 + 1/(1 + Exp[( > > PD2u + 34.9)/3.6])); > > PD2taumk1[PD2u_] := 7.2 - 6.4/(1 + Exp[-(PD2u + 28.3)/19.2]); > > > > > > solution = NDSolve[{ > > > PD2mnax'[t] == (PD2mnax0[PD2z[t]] - PD2mnax[t])*(1/ > > PD2taumnax[PD2z[t]]), PD2mnax[0] == PD2mnax0[-80]*(1/ > > PD2taumnax[-80]), PD2hnax'[t] == (PD2hnax0[PD2z[t]] - PD2hnax[ > > t])*(1/PD2tauhnax[PD2z[ > > t]]), PD2hnax[ > > 0] == PD2hnax0[-80]*(1/PD2tauhnax[-80]), > > PD2mkx'[t] == (PD2mk10x[PD2z[t]] - \ > > PD2mkx[t])*(1/PD2taumk1[PD2z[t]]), > > PD2mkx[0] == PD2mk10x[-80]*(1/PD2taumk1[-80]), PD2z'[t] == (-1*(0 > > + 1*1100*(PD2mnax[t]^3)*PD2hnax[t]*(PD2z[t] - 50) > > + 1*150*(PD2mkx[t]^4)*(PD2z[t] + 80) > > + 1*0.00081*(PD2z[t] + 50) > > ) > > *(1/6)), > > PD2z[0] == SmV > > > }, > > > > > {PD2z, PD2mnax, > > PD2hnax, PD2mkx}, {t, 0, time}, Method -> Automatic, MaxSteps -> \ > > Infinity]; > > > > ParametricPlot[Evaluate[{t, PD2z[ > > t]} /. solution], {t, 0, time}, > > PlotPoints -> time, PlotRange -> {-80, 50}, PlotLabel -> "PD Axon"]; > > (* > > mkw = Table[0, {time-1}]; > > For[w=1,w<(time),mkw[[w]]=PD2z[w]/.solution;w++]; > > mkw > > *) > > > > ******************************* > > > > > > This produces what looks like a flat line on a graph. > > I need to run this file several times changing the variable SmV. Can I > encapsulate the whole thing in a function? I have tried but it doesn't work. > > > fun[]:= (SmV; > > ***code*** > > ) > > fun[-80] > > out- fun[-80] > > > > Thank you > > David Fourie > > > > > > >