Re: manipulate, NDSolve, Evaluate
- To: mathgroup at smc.vnet.net
- Subject: [mg98134] Re: manipulate, NDSolve, Evaluate
- From: pajake <jtrexel at ix.netcom.com>
- Date: Tue, 31 Mar 2009 04:17:32 -0500 (EST)
- References: <gqkuu9$4ad$1@smc.vnet.net> <gqn8q9$t6g$1@smc.vnet.net>
Here is what I have done so far. (* First is an injected current that is applied to the cell*) i[t_] := If[t < 10 || t > 60, 0, 1] (* now to plot the above equation *) Plot[i[t], {t, 0, 100}, PlotStyle -> {Red, Thick}] (* The equation for an RC circuit. Note the IC, and that c = 1. *) RCSoln1[R_, c_: 1, v0_: 0] := NDSolve[{v'[t] == 1/c (i[t] - v[t]/R), v[0] == v0}, v, {t, 0, 100}] (* Now plotting the above equation, and assigning R = 1 *) Plot[Evaluate[v[t] /. {RCSoln1[1]}], {t, 0, 100}, PlotStyle -> {Red, Thick}] (* Now let R = 1, and change the value of the capacitance in the plot to see what differences this makes *) RCSoln1a[R_: 1, c_, v0_: 0] := NDSolve[{v'[t] == 1/c (i[t] - v[t]/R), v[0] == v0}, v, {t, 0, 100}] p1 = Plot[Evaluate[v[t] /. {RCSoln1a[1]}], {t, 0, 100}, PlotStyle -> {Blue, Thick}] p2 = Plot[Evaluate[v[t] /. {RCSoln1a[5]}], {t, 0, 100}, PlotStyle -> {Red, Thick}] Show[p1, p2] Now compare the difference in the way the plots look when you change the R (resistance) vs the c (capacitance). In order for the capacitance to change like shown. What could cause the changes in the resistance and the capacitance? ? What I would like is: to use Manipulate with a slider to vary "c" and "R". I tried to use this equation. NDSolve[{v'[t] == 1/(a*c) (i[t] - v[t]/(b*R), v[0] == v0}, v, {t, 0, 100}]. I changed the equation by putting (a*c) and (b*R). Then with the plot I thought I could add: Manipulate[Plot[Evaluate[v[t] /. {RCSoln1a[1]}], {t, 0, 100}, ,{a, 0, 5}, (b, 0, 5) PlotStyle -> {Blue, Thick}]] It did not work. This is just the beginning of the text book that I am writing. Thus I did not go into the finer details of the soma's wall thickness and how it changes capacitance. I just wanted to show in a graphic manner what could happen and illustrate a basic equivalent circuit for a cell membrane. Later on in the book, I go into more details. Can you help me now? Thanks once again Prof Jake Sjoerd C. de Vries wrote: > If you've already done it for a specific wall thickness it should be > very easy to do the same in a Manipulate for variable thickness > values. > > Please post more details if you want more specific assistence. > > Cheers -- Sjoerd > > On Mar 28, 12:42 pm, pajake <jtre... at ix.netcom.com> wrote: > >> I am trying to combine, NDSolve with a ODE then using Plot[evaluate] to >> show the results, and then I would like to take it to the next step and >> use Manipulate. >> >> I am working a cell membranes capacitance based on the wall thickness. = >> > > >> I would like the plot to show the the membrane voltage vs time,(I have >> done this with NDSolve and Plot), but I would like to use a slider that >> reflects the difference in the cell membranes thickness which affects >> the capacitance. >> Is this possible? >> thanks >> Prof. Jake >> > > >