Re: Piecewise with ODE and constant
- To: mathgroup at smc.vnet.net
- Subject: [mg104770] Re: Piecewise with ODE and constant
- From: sean <sean_incali at yahoo.com>
- Date: Mon, 9 Nov 2009 05:45:33 -0500 (EST)
- References: <hd6c4q$p43$1@smc.vnet.net>
> eq=v'[t]*1/c *(i-v[t]/r) This is not an equation. DSolve requires an equation. v[t]==v[t] for instance. > r=100 x 10^6;i=0.3 x 10^-9;c=100 x 10^-12; > x is not multiplication. * is used instead. So r= 100*10^6 > ans=DSolve[{eq,v[0]==0},v[t],t] > > p1=Plot[v[t]/.ans,{t,0,140 x 10^-3}] Again x is not multiplication. 140*10^-3 > > Plot[Piecewise[{{-70 x 10^-3,0*t*10 x 10^-3},{ans,10 x 10^-3*t*100 x 10^-3},{-70 x 10^-3,100 x 10^-3*t*140 x 10^-3}}],{t,0,140 x 10^-3}] I'm not sure what you want above. If you want to define an ode piecewise then you have to define is like this. But what yousaid you want is i0[t_]:= i0[t]/; 10 <= t <= 100; i0[t_] := 0/; t < 0; i0[t_] := 0/; 0 <= t <= 10; i0[t_] := 1/; 10 <= t <= 100; deqn = i0[t] == v[t]/r + c v'[t]; NDSolve will solve that. On Nov 8, 4:04 am, "Becky" <noslow... at comcast.net> wrote: > I have tried so many different ways to do this problem, that I am stuck. > Its like being back I school. > > I would like to plot my ODE which is a curve that goes starts at 10 msec and > ends at 100 msec). In the beginning there is no current delivered to t he > cell until time equal 10 msec. Once the current probe in inserted to the > cell, I have a ODE, which is modeled as an RC circuit. When time equal 100 > msec, the current it turned off, and the curve should go back to the > original state. I have tried using If statements, Piecewise plots, and so > on, but I cannot get the curve to work with the initial and final conditions > of -70 mV. > > I would like to stay with solving the ODE using Dsolve, vs., NDSolve, if > that is ok. I cannot figure out my problem, I need help, please. > > Sincerely Yours > Prof. Jake > > eq=v'[t]*1/c *(i-v[t]/r) > > r=100 x 10^6;i=0.3 x 10^-9;c=100 x 10^-12; > > ans=DSolve[{eq,v[0]==0},v[t],t] > > p1=Plot[v[t]/.ans,{t,0,140 x 10^-3}] > > Plot[Piecewise[{{-70 x 10^-3,0*t*10 x 10^-3},{ans,10 x 10^-3*t*100 x 10^-3},{-70 x 10^-3,100 x 10^-3*t*140 x 10^-3}}],{t,0,140 x 10^-3}]