From: Becky on
Can the following be made interactive? I would like my students to see
there results quickly when changing certain values such as the resistance
and capacitance.


Thanks


My code so far

i[t_]:=If[t<10||t>60,0,1]
Plot[i[t],{t,0,100},PlotStyle->{Blue,Thick}]
RCSoln[R_,c_:1,v0_:0]:=NDSolve[{v*[t]*1/c
(i[t]-v[t]/R),v[0]*-70},v,{t,0,100}]
Plot[Evaluate[v[t]/.
{RCSoln[5]}],{t,0,100},PlotRange*{{0,100},{-80,10}},PlotStyle->{Blue,Thick}]



From: dh on


Hi,

you have syntax errors. Your equations are no equations:



NDSolve[{v*[t]*1/c(i[t]-v[t]/R),v[0]*-70}...



Daniel





Becky wrote:

> Can the following be made interactive? I would like my students to see

> there results quickly when changing certain values such as the resistance

> and capacitance.

>

>

> Thanks

>

>

> My code so far

>

> i[t_]:=If[t<10||t>60,0,1]

> Plot[i[t],{t,0,100},PlotStyle->{Blue,Thick}]

> RCSoln[R_,c_:1,v0_:0]:=NDSolve[{v*[t]*1/c

> (i[t]-v[t]/R),v[0]*-70},v,{t,0,100}]

> Plot[Evaluate[v[t]/.

> {RCSoln[5]}],{t,0,100},PlotRange*{{0,100},{-80,10}},PlotStyle->{Blue,Thick}]

>

>

>



From: Albert Retey on
Hi,

> Can the following be made interactive? I would like my students to see
> there results quickly when changing certain values such as the resistance
> and capacitance.

sure it can. This is one simple possibility:


i[t_] := If[t < 10 || t > 60, 0, 1];

RCSoln[R_, c_:1, v0_:-70] :=
NDSolve[{v'[t] == 1/c (i[t] - v[t]/R), v[0] == v0}, v, {t, 0, 100}]

Manipulate[
Plot[Evaluate[v[t] /. RCSoln[r, c, v0]], {t, 0, 100},
PlotRange -> {{0, 100}, {-80, 10}}, PlotStyle -> {Blue, Thick},
Frame -> True],
{r, 0.1, 10},
{c, 0.1, 10},
{v0, -80, -50}
]


hth,

albert

From: DrMajorBob on
This does the integration once (symbolically), rather than all over again
(numerically) every time r, c, or v0 is changed:

Clear[i, v, v0, r, c]
i[t_] = Boole[10 <= t <= 60];
v[r_, c_, v0_, t_] =
v[t] /. First@
Assuming[{-80 <= v0 <= -50, 1/10 <= c <= 10, , 1/10 <= r <= 10},
DSolve[{v'[t] == 1/c (i[t] - v[t]/r), v[0] == v0}, v, t]];
Manipulate[
Plot[v[r, c, v0, t], {t, 0, 100}, PlotRange -> {{0, 100}, {-80, 10}},
PlotStyle -> {Blue, Thick}, Frame -> True], {r, 0.1, 10}, {c, 0.1,
10}, {v0, -80, -50}]

Bobby

On Thu, 10 Dec 2009 03:59:27 -0600, Albert Retey <awnl(a)gmx-topmail.de>
wrote:

> Hi,
>
>> Can the following be made interactive? I would like my students to see
>> there results quickly when changing certain values such as the
>> resistance
>> and capacitance.
>
> sure it can. This is one simple possibility:
>
>
> i[t_] := If[t < 10 || t > 60, 0, 1];
>
> RCSoln[R_, c_:1, v0_:-70] :=
> NDSolve[{v'[t] == 1/c (i[t] - v[t]/R), v[0] == v0}, v, {t, 0, 100}]
>
> Manipulate[
> Plot[Evaluate[v[t] /. RCSoln[r, c, v0]], {t, 0, 100},
> PlotRange -> {{0, 100}, {-80, 10}}, PlotStyle -> {Blue, Thick},
> Frame -> True],
> {r, 0.1, 10},
> {c, 0.1, 10},
> {v0, -80, -50}
> ]
>
>
> hth,
>
> albert
>


--
DrMajorBob(a)yahoo.com