Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3176 > unrolled thread
| Started by | "J and B" <noslowski@comcast.net> |
|---|---|
| First post | 2011-06-18 21:44 +0000 |
| Last post | 2011-06-18 21:44 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: capacitor equation solution not working "J and B" <noslowski@comcast.net> - 2011-06-18 21:44 +0000
| From | "J and B" <noslowski@comcast.net> |
|---|---|
| Date | 2011-06-18 21:44 +0000 |
| Subject | Re: capacitor equation solution not working |
| Message-ID | <itj68n$k44$1@smc.vnet.net> |
Sorry for not typing my code in correctly. I have the same code as you,
that is mentioned in this email
i[t_] := If[t < 10 || t > 60, 0, 1]
eq = v'[t] == i[t]/c;
c = 1;
soleq = v[t] /. First@NDSolve[{eq, v[0] == 0}, v[t], {t, 0, 100}];
Plot[soleq, {t, 0, 100}]
But I thought it had to be wrong, since the capacitor never came back to
zero. I did not realize that I had to have a resistor in the circuit, as
several people pointed out.
Thanks for your help
-----Original Message-----
From: DrMajorBob [mailto:btreat1@austin.rr.com]
Sent: Friday, June 17, 2011 5:53 AM
Subject: Re: capacitor equation solution not working
Surely that is NOT your code; it has at least four misspellings and two
fatal syntax errors -- == where you need = (as in Soleq = ...) and the comma
before [[1]].
If you ran that code, you'd see error messages, not just a constant plot.
This works, however:
i[t_] := If[t < 10 || t > 60, 0, 1]
eq = v'[t] == i[t]/c;
c = 1;
soleq = v[t] /. First@NDSolve[{eq, v[0] == 0}, v[t], {t, 0, 100}];
Plot[soleq, {t, 0, 100}]
I'd also suggest THIS for the first line:
i[t_] := Boole[10 <= t <= 60]
Bobby
On Thu, 16 Jun 2011 23:09:13 -0500, J and B <noslowski@comcast.net> 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}]
--
DrMajorBob@yahoo.com
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web