The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: capacitor equation solution not working
Replies: 1   Last Post: Jun 17, 2011 5:06 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,677
Registered: 2/7/05
Re: capacitor equation solution not working
Posted: Jun 17, 2011 5:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/16/2011 9:09 PM, J and B wrote:
> I am trying to solve a very simple circuit, one that has only a capacitor in
> it. What am I doing wrong? The final graph should show that the capacitor
> has discharged, but its staying constant. I have current starting at t=10
> and ending at t=60.
> I hope I have used the correct way to put in my code, I am using a new
> computer and I having trouble with my email program. Any advice would be
> appreciated.
> Thanks
> My code.
> I[t_]:= If[t<10||t>60,0,1]
> Plot[i[t],{t,0,100}]
> Eq=v'[t]==i[t]/c
> c=1;
> Soleq==v[t]/.NDSolve[{eq,v[0]==0},v[t],{t,0,100}],[[1]]
> Plot[soleq,{t,0,100}]

Mathematica is case senstive. Try this:

f[t_] := If[t < 10 || t > 60, 0, 1]
Plot[f[t], {t, 0, 100}]
eq = v'[t] == f[t]/c
c = 1;
soleq = v[t] /. First[NDSolve[{eq, v[0] == 0}, v, {t, 0, 100}]]
Plot[soleq, {t, 0, 100}]


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.