Re: NDSolve problem
- To: mathgroup at smc.vnet.net
- Subject: [mg104990] Re: NDSolve problem
- From: dh <dh at metrohm.com>
- Date: Tue, 17 Nov 2009 05:13:08 -0500 (EST)
- References: <hdompj$92g$1@smc.vnet.net>
Becky wrote:
> Please see my code below. I would like to have the NDSolve plot to come up
> differently, in that I would like it to start (time 0 to 10 to have the
> value as shown in the plot which is (5.992). Which is the same where (t 100
> to 140).
>
> Thanks for your continued support.
>
> i[t_]:=If[t<10||t>100,-3,1]
> Plot[i[t],{t,0,140},PlotStyle->{Red,Thick},AxesLabel->{time,current}]
> so[r_,c_:1,v0_:0]:=NDSolve[{v'[t]==1/c* (i[t]-v[t]/r),v[0]==0},v,{t,0,140}]
> Plot[Evaluate[v[t]/.{so[2]}],{t,0,140},AxesLabel->{time,voltage}]
>
>
>
Hi,
your question is not very clear. Do I understand correctly that you want
to change to initial vale from 0 to -5.992:
i[t_] := If[t < 10 || t > 100, -3, 1]
Plot[i[t], {t, 0, 140}, PlotStyle -> {Red, Thick},
AxesLabel -> {time, current}]
so[r_, c_: 1, v0_: 0] :=
NDSolve[{v'[t] == 1/c*(i[t] - v[t]/r), v[0] == -5.992},
v, {t, 0, 140}]
Plot[Evaluate[v[t] /. {so[2]}], {t, 0, 140},
AxesLabel -> {time, voltage}]
Daniel