Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Piecewise with ODE and constant

7 views
Skip to first unread message

Becky

unread,
Nov 8, 2009, 7:04:42 AM11/8/09
to
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 the
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}]

sean

unread,
Nov 9, 2009, 5:55:16 AM11/9/09
to
> 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.

Murray Eisenberg

unread,
Nov 12, 2009, 6:02:48 AM11/12/09
to
You don't have a differential equation (yet) in eq. Did you intend the
equation to be:

v'[t] (1/c) (i - v[t]/r) == 0

?

Becky 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 the
> 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}]
>

--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

0 new messages