Re: Re: RC circuit

*To*: mathgroup at smc.vnet.net*Subject*: [mg56864] Re: [mg56845] Re: [mg56844] RC circuit*From*: "David Park" <djmp at earthlink.net>*Date*: Sun, 8 May 2005 02:10:15 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Interesting - and better. From: DrBob [mailto:drbob at bigfoot.com] To: mathgroup at smc.vnet.net To insert values for "data" at the last minute (even in the Plot legend), try this: Block[{Plot, ToString, StringJoin}, Plot[v@t, {t, 0, 50}, Frame -> True, FrameLabel -> {"t seconds", "v volts"}, PlotLabel -> "Voltage in an RC Circuit", Epilog -> {Text["c = " <> ToString@c <> " Farads", {30, 4}, {-1, 0}], Text["i = " <> ToString@i <> " Amperes", {30, 3.5}, {-1, 0}], Text["r = " <> ToString@r <> " Ohms", {30, 3.0}, {-1, 0}]}, ImageSize -> 450] /. data ]; That eliminates the need for Evaluate, too. Bobby On Sat, 7 May 2005 15:35:07 -0400 (EDT), David Park <djmp at earthlink.net> wrote: > 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. > > Clear[v]; > 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. > > Clear[v]; > 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 earthlink.net > http://home.earthlink.net/~djmp/ > > > > > > From: pennsylvaniajake at netscape.net To: mathgroup at smc.vnet.net > > > 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 > thanks > >> > > > > > > -- DrBob at bigfoot.com