# An equation to generate the output of a driven RC circuit.

#### 52midnight

I posted on the Mathematica thread of the Raspberry Pi forum (https://www.raspberrypi.org/forums/viewtopic.php?f=94&t=174635) in search of an equation describing the behaviour of an electronic RC network. It's a standard topic in undergraduate maths, but not in the depth I require. Here's an edited version of the thread:

This is more about mathematics and electronics, but I'd like to use Mathematica to generate the graphs I need. It's probably something that others might also find useful.

Given: a voltage source Vo with an output of 0V - 5V at a frequency Fclk. One end of a resistor R is connected to Vo, the other end to a capacitor C, the second terminal of C being connected to 0V.

Required: an equation of the form v = f(t) that gives the voltage across the capacitor at time t.

Working: I've only ever solved for a steady voltage using some variant of the standard equation dv/dt = i/C. The standard text-book integration is over the interval (inf - t] and does not address varying voltages. My maths isn't good enough to know where to start with a solution, and I'd be most grateful for any pointers to info or suggestions for a solution.

A respondent replied:

What you have described is an RC low-pass filter.
Look up in wiki under RC filters. The -3dB point frequency is at 1/(2*PI*R*C).

... to which I responded:

The filter analyses I've seen treat the RC combination as a frequency-dependent network, and thus use the frequency domain as the abscissa rather than time, as I require.

The other analyses use a "step" approach. They use starting conditions to plot the v:t curve using the standard exponential function up to the first half-cycle of the waveform, then change the form of the equation to recalculate using the new voltage for the next half-cycle, and repeat this until a steady state becomes evident. This strikes me as rather inelegant, and I've no idea how to insert it into Mathematica to create the graph I want.

On the other hand, I don't know of any mathematical formalism that allows a "continuous" equation to be derived. There may be one in e.g. multivariable calculus, but my knowledge doesn't stretch that far.

... there are two independent variables - time and current - and one dependent variable - the voltage across the capacitor. The current into and out of the cap is determined by the drive voltage applied to the resistor, which alternates over time.

Standard diff equns are of the form y = dx/dz so integrating with respect to z yields a function x = F(y), typically using a standardized integral.

One possibility is partial differential equations. I've only ever encountered them in the vector analysis of fields, usually dx/dt, dy/dt and dz/dt. Whether or not the technique could be applied here I'm not knowlegeable enough to say.

I'd be most grateful for any assistance, and would like to post back anything useful to the Rpi forum, with permission and attribution.

Last edited:

Math Team

#### 52midnight

Very nice presentation. Thanks!

#### weirddave

The other analyses use a "step" approach. They use starting conditions to plot the v:t curve using the standard exponential function up to the first half-cycle of the waveform, then change the form of the equation to recalculate using the new voltage for the next half-cycle, and repeat this until a steady state becomes evident. This strikes me as rather inelegant, and I've no idea how to insert it into Mathematica to create the graph I want.
I'm not familiar with mathematica, but that is the way I'd solve it.

A continuous function is a lot more difficult to produce because the output is dependent on everything that came before it. If you need something that 'looks' continuous, you could use tiny timesteps and compute the output for each, the input would also be an equation (this also allows you to calculate the output for any varying input, you could play an mp3 through it for example). I have used this method a lot as it's fast and easy.

It does look as if it's possible to compute a continuous function:
How do I solve and plot the equations for an RC circuit? - Online Technical Discussion Groupsâ€”Wolfram Community
You're going to want to use a squarewave as the input:
SquareWaveâ€”Wolfram Language Documentation

#### priyya

Indian government is recruiting teachers for Mathametics in various States. Those who are looking to prepare for it and various other jobs they sould visit Top1. Top1.in is an educational website which provides information about various government exam. That could be a state-level exam or regional level exam. Top1 provides exam syllabus, hall ticket and various information about it.