MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: RC circuit

Here is one method to solve your exercise. You can use 'i' for current but
not 'I', which is a reserved symbol. In general you should avoid symbols
that start with capital letters. Also notice that 'equal' is represented by
== in Mathematica.

Here is your equation.

deqn = i == v[t]/r + c v'[t];

Now we solve the equation and add the initial condition that v starts at 0
when t == 0.

dsolutions = DSolve[{deqn, v[0] == 0}, v, t]
v[t_] = v[t] /. Part[dsolutions, 1, 1]
{{v -> Function[{t}, ((-1 + E^(t/(c*r)))*i*r)/E^(t/(c*r))]}}
((-1 + E^(t/(c*r)))*i*r)/E^(t/(c*r))

Now we need a set of data for some particular case to plot.

(data = {c -> 3, i -> 2, r -> 2.5}) // TableForm

Now we can plot, We want to substitute the data into the expression for v[t]
and we want to evaluate the expression in the Plot statement. I've added
labels and text to make a more informative plot.

Plot[Evaluate[v[t] /. data], {t, 0, 50},
    Frame -> True,
    FrameLabel -> {"t seconds", "v volts"},
    PlotLabel -> "Voltage in an RC Circuit",
    Epilog -> {Text["c = 3 Farads", {30, 4}, {-1, 0}],
        Text["i = 2 Amperes", {30, 3.5}, {-1, 0}],
        Text["r = 2.5 Ohms", {30, 3.0}, {-1, 0}]},
    ImageSize -> 450];

It does take a little time to learn the syntax and available commands in
Mathematica before one can efficiently use it to solve practical problems
and homework exercises. But it is worth it if you expect to do much of it.

David Park
djmp at

From: pennsylvaniajake at
To: mathgroup at
[mailto:pennsylvaniajake at]

 Two ?'s  I am trying to solve a simple RC circuit.  ?1  I can's use the
 letter "i" for current, is there a way around this ?
 ?2. How do I solve this equation for dv/dt,  eq:  i = v/r + C dv/dt


  • Prev by Date: Re: Re: Mathematica Notebook Organiztion
  • Next by Date: Re: How to quickly find number of non-zero elements in sparse matrix rows?
  • Previous by thread: Re: RC circuit
  • Next by thread: Re: Re: RC circuit