Message Boards Message Boards

How do I solve and plot the equations for an RC circuit?

I am trying to solve the and plot the equations for an RC circuit. What I have so far is

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

Any help would be appreciated.

Thanks

POSTED BY: Jake Trexel
8 Replies
Posted 10 years ago

I am guessing from your wording that something didn't work, but I can't guess what.

Can you be much much more specific about what you want, what you did and what went wrong?

Or, if you start Mathematica fresh, type in the simplest example of exactly what you are trying to do, don't edit or replace or try again and again, just type (or paste, but even that can be more problematic) your problem, evaluate the whole notebook once, immediately save the notebook and attach that notebook to a post along with a clear simple verbal description of exactly what you were trying to accomplish and why it doesn't seem to be the result you were looking for then I'll give another try at what I hope will help you get where you want to go.

POSTED BY: Bill Simpson
Posted 10 years ago

Hi Jake,

I was mistaken when I said your equation was incorrect. That's the equation I gave for a parallel RC circuit. The only difference being you are taking i[t] as a given and you are solving for v[t]. I didn't notice that they were the same equations in different form.

I think your notebook looks great.

Kind regards,

David

POSTED BY: David Keith
Posted 10 years ago

Hi again -- I attach the notebook. It assumes we will know v[t] and want i[t] for each. Note that in the parallel case we don't need to solve a diffeq to get that. In the series case we do, and Mathematica supplies integration constants which can be used to accommodate initial conditions.

Attachments:
POSTED BY: David Keith
Posted 10 years ago

See if you can modify this

In[1]:= i[t] = 4; r = 2; c = 3;
sol = v[t] /. DSolve[{v'[t] == (1/c)*(i[t] - v[t]/r), v[0] == 0}, v[t], t]

Out[2]= {8 E^(-t/6) (-1 + E^(t/6))}

In[3]:= Plot[sol[[1]], {t, 0, 20}]

Out[3]= ...PlotSnipped...
POSTED BY: Bill Simpson

Bill, this gave me more problems than I had!

POSTED BY: Jake Trexel
Posted 10 years ago

Hi Jake, I think your equation is incorrect. For parallel (trivial) and series RC circuits driven by an arbitrary v[t] I get the solutions below. (Sorry about Out[4] -- this new code system seems awkward at best.)

In[1]:= parallelEq = i[t] == c v'[t] + v[t]/r

Out[1]= i[t] == v[t]/r + c Derivative[1][v][t]

In[2]:= (* trivial *)
DSolve[parallelEq, i[t], t]

Out[2]= {{i[t] -> (v[t] + c r Derivative[1][v][t])/r}}

In[3]:= seriesEq = v'[t] == r i'[t] + i[t]/c

Out[3]= Derivative[1][v][t] == i[t]/c + r Derivative[1][i][t]

In[4]:= DSolve[seriesEq, i[t], t]

Out[4]= {{i[t] -> E^(-(t/(c r))) C[1] + E^(-(t/(c r))) \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(1\), \(t\)]\(\*
FractionBox[
RowBox[{
SuperscriptBox["E", 
FractionBox[
RowBox[{"K", "[", "1", "]"}], 
RowBox[{"c", " ", "r"}]]], " ", 
RowBox[{
SuperscriptBox["v", "\[Prime]",
MultilineFunction->None], "[", 
RowBox[{"K", "[", "1", "]"}], "]"}]}], "r"] \[DifferentialD]K[1]\)\)}}
POSTED BY: David Keith

Here is my program, and it matches my neuroscience book. I was missing the first line of code.

Attachments:
POSTED BY: Jake Trexel

Thank you David.

POSTED BY: Jake Trexel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract