A tank fills from a reservoir through a narrow pipe. Watch the gap to full, and how fast the level climbs as the gap shrinks.
Describe this picture
The reservoir, the pipe and the tank, with a small circuit beside them, and the voltage curve, for s and a 1 V battery. A point travels along the curve, with a bar from the point up to 1 V marked “gap”. Two readouts show “gap” in volts and “speed” in volts per second. At the start both show 1.000, and the caption says “The tank is empty, so the gap is biggest and it fills fastest.” At s the caption says “Still not there: the gap shrinks but never closes.” The clip plays once by itself; when it ends, a handle ”↔ drag the point” appears, and the point can be dragged along the curve to try other moments.
A tank that fills more slowly as it fills
The page Difference equations (6.1) counted time in samples. A circuit has no samples, because its voltage changes at every instant. Here I write the rule for such a circuit, and at the end I show how it ties to the leaky integrator of 6.1.
Start with a tank. It is filled from a reservoir through a narrow pipe, the reservoir level is 1, and the tank starts empty. Water flows fast at first, because the difference in level is large. As the tank fills, the difference shrinks and the flow slows: the further from full, the faster it fills.
An electric circuit does the same. The tank is a capacitor, which stores charge, and the voltage across it plays the part of the level. The pipe is a resistor of resistance , and the reservoir is a battery. This is the RC circuit from Continuous-time convolution (5.3). There I drove it with a spike of current; here the battery pushes current through the resistor, and that current is the gap divided by .
I call the voltage still missing the gap. It is the battery voltage minus the capacitor voltage , so the gap is .
Go back to the picture at the top of the page. At the start the gap and the speed both read 1.000, the biggest of the run. At s the voltage is V, and the gap and the speed have both fallen to . At s the gap is V, small but not zero. The two readouts show the same number only because s.
Turning the picture into an equation
I need a symbol for the speed. Write for , the slope of the voltage curve, in volts per second. Two facts about a circuit then give the equation. The voltage across the resistor is the gap, so the current is (Ohm’s law). The current into the capacitor is , where is its capacitance.
The same current flows through both, so . Multiply by and move to the left. For a battery that stays at , or for any source voltage , this reads
This is a differential equation: an equation that has the slope of the unknown curve in it. Its answer is a whole curve, one voltage for every instant, as the answer to a difference equation is a whole row of stems. In words, the slope is the gap divided by . That sentence is the picture at the top of the page: a big gap gives a steep curve, and a small gap gives a flat one.
The time constant
Two circuits can use the same equation and still behave very differently. A camera flash charges its capacitor in a few seconds, and a slow timer takes minutes. The difference is the product , the resistance times the capacitance, in seconds.
To see what does, draw the tangent at the start of the curve. Its slope is the starting speed, . If the curve kept that speed, it would reach after exactly seconds.
Watch where the tangent meets the 1 V line, and the marker on the curve directly below it, as grows.
Describe this picture
The charging curve and the line labelled “tangent”, starting at s with the readout “RC = 0.50 s”. The tangent meets the 1 V line at s, and a marker labelled “RC” sits on the curve directly below that meeting, at , labelled 63.2%. During the run grows from s to s; the curve, the tangent and the marks stretch sideways together, and marks at 2, 3 and 5 time constants read 86.5%, 95.0% and 99.3%. When it ends, the handle ”↔ drag the 63.2% marker” appears, and dragging the marker sets .
The marker is at : by one the curve has covered 63.2 % of the way. We call this time the time constant, and I write it .
As grows, the curve, the tangent and the marks stretch sideways together, as one shape. This is the time scaling of Shifting, reversing and scaling time (2.1). When the clip ends, drag the marker to set yourself, and notice that the shape never changes. Only the horizontal scale does.
The same percentages appear at every circuit, counted in time constants:
| Time | Share of the way covered |
|---|---|
| 63.2 % | |
| 86.5 % | |
| 95.0 % | |
| 98.2 % | |
| 99.3 % |
The curve itself is for when the battery is switched on at with the capacitor empty. You can check it against the equation. The gap is , and the slope of the curve is , which is the gap divided by . It also starts at 0, as the empty capacitor does. This agrees with the pulse example in 5.3, where s gave while the pulse was on.
The curve never reaches , because the gap is positive for every . At it is 0.7 % of . That is small enough to ignore in practice, but the equation never says “full”.
How long does the curve take to reach 90 %? Then the gap is 10 % of what it started as, so . Here I use , the natural-log key on a calculator. It undoes : if , then . (The of How big is a signal (1.3) is the other key, used for decibels.) With this gives .
Natural part and forced part
Now start the capacitor already holding V, and connect the 1 V battery. The gap is only half as big as before. Take a warm cup of tea: in a cold room it cools to the cold level, and in a warm room it cools to a warmer level. The room sets where it ends up, and the cup’s own start sets the rest.
Before you watch, make a guess. After one , will the capacitor have covered more than, less than, or exactly 63.2 % of its gap?
Describe this picture
The capacitor starts at 0.5 V, with s and a 1 V battery. The total is drawn first, a curve from V up to 1 V. Then it separates into two pieces: the flat line at 1 V, tagged “forced: slope zero here”, and a fading piece below the axis, tagged “natural: minus the gap”, with a bar marked “gap 0.5” beside it showing the same length with the sign flipped. The last frame adds an inset titled “A different cut, at t = 1 s”, with the lines “stored charge leaking away 0.184”, “charge-up from empty 0.632” and “also 0.816”.
The total curve separates into two pieces: a flat line at 1 V, and a fading piece below the axis that is the gap with its sign flipped.
The forced part is the level the battery insists on. It is the only voltage at which the slope is zero, because with gives . The natural part is what the circuit does when the battery has no say. It solves the equation with the right side set to 0, , which is called the free equation.
To find the natural part, try . In Complex exponentials & phasors (3.4) the exponent had a spin, and was a spiral. With no spin the spiral does not turn, and is a plain decay, so here is a real number. Its slope is , so the free equation becomes
Divide by and you get , so . The natural part is a constant times . I call that constant , because is already the capacitance.
Adding the two parts gives . The sum solves the full equation, because the equation is linear: the forced part leaves on the right, and the natural part adds nothing. The start value fixes . Here and , so and :
The natural part, , is minus the gap: it is the gap bar from the start of this page with its sign flipped. At the gap has shrunk by the same 63.2 % as before. It closed of its , so the answer to the guess is exactly 63.2 %, and the voltage is V.
6.1 also cut an answer in two, but with a different cut. There the pieces were what the stored charge does alone (the zero-input response, with the source off) and what the source does from an empty capacitor (the zero-state response). Here the pieces are where the voltage is heading and the gap that remains. Both cuts add up to the same curve.
For this circuit at s, the stored V leaks to and the charge-up from empty is . Their sum is , the same number as . The last frame of the picture shows this cut too.
The same equation in a spring
The next instrument has no new idea. It shows that a different physical system gives the same kind of equation, with a second slope in it. I write for , the slope of the slope. For a mass on a spring it is the acceleration.
Take a mass on a spring of stiffness , with a damper of strength : a piston in oil that pushes back against the speed. Newton’s law says the mass times the acceleration equals the sum of the forces, from the spring and from the damper. With the distance from rest (here is a position, not an input), this gives
Now take a circuit with a coil, a resistor and a capacitor in a row. A coil’s voltage is times how fast its current changes, . It resists changes of current the way a mass resists changes of speed. With the capacitor current , the loop of voltages gives when the source is off.
The two equations have the same shape, so I pair the parts. The mass goes with the inductance , the damper with the resistance , and the spring stiffness with . A car suspension is the mechanical one, and a radio tuner is the electrical one.
Watch the mass swing, and the two lines on the plot.
Describe this picture
A mass on a spring with a damper, and next to it a coil, a resistor and a capacitor. The mass starts pulled aside and is released, with the caption “A mass on a spring, pulled aside. Next to it, a coil, a resistor and a capacitor.” It swings, and the swings shrink. The plot has a solid line labelled “mass position” and a dashed line labelled “capacitor voltage”, and the caption ends “The mass and the capacitor voltage trace one curve.”
The swings shrink, and the dashed capacitor voltage lies on the solid mass position: they trace one curve.
I chose kg, Ns/m and N/m for the spring, and H, and F for the circuit. Since , both equations become , with standing for the distance or the voltage. Why it swings, and how fast the swings shrink, is the job of First- and second-order systems (6.3).
A circuit and its discrete copy
DSP students keep analog circuits around for a practical reason. Often a program has to imitate one, such as a smoothing filter in a sensor, and the program runs in steps. The leaky integrator of 6.1 turns out to be the exact step-by-step copy of the RC circuit.
Here is the setting. Hold the input constant over each interval of seconds, and let be its value in interval . For a constant input that is the sample of Sinusoids (3.2). Over one interval the gap shrinks by the factor , because a gap that starts at is after seconds, as in the natural part above. Call this factor .
Let be the voltage at the start of the interval. The gap at the start is , and at the end it is times that, so the voltage at the end is
Rearranged, this is exactly the leaky integrator of 6.1:
Because is the voltage at , the output is the voltage at the end of interval : . The empty capacitor, , is initial rest, .
Here is a concrete check. Take s and sample every s, so . The plot in the next instrument is in seconds, not sample numbers. Output is worked out from the input held over the first half-second, so it is the voltage at the end of that half-second. The first stem stands at s, and stem stands at .
We sample the circuit every s with this recursion. Will the stems be on the curve, or only near it?
Describe this picture
The charging curve, labelled “circuit, RC = 1 s”. One after another, a stem drops onto the curve at s and so on, labelled with its sample number and, under the axis, its value. Above the plot, the arithmetic of the newest stem is written out, and a caption says what the newest stem shows.
The second stem is the check. With four-digit numbers the recursion gives , which is the value of the curve at s, and the caption says so. The stems do not just resemble the curve. They are exactly on it, at the end of each half-second, up to the eighth stem at .
For a step input, every , so the recursion gives , the step response of 6.1’s leaky integrator. In the circuit’s own terms, , which is from the continuous curve. The tie between the two systems is a single line, .
Worked example
- Step response, s. With V, . At s it is 0.63212, 0.86466, 0.95021, 0.98168 and 0.99326 V, so the gap at s is V. The slope at s is V/s, so the tangent there reaches at s: one later, as at every point. Time to 90 %: , so s.
- A fast circuit. Take ms switched onto 5 V. After one time constant, V. It reaches 90 % of 5 V, which is 4.5 V, at ms ms.
- Pre-charged, natural plus forced. Try in : . The slope is zero at , the forced part. So , and gives : . For s, V. The other cut gives zero-input plus zero-state , which is also . The gap of closed by , which is %.
- Spring and circuit, only the pairing. The spring has and the circuit has , so . Both are . The swing and its decay are worked out in 6.3.
- Discrete copy. With s and s, . Then . Next, . In general , so , and .
Where you’ll meet this
Many analog sensor inputs and audio outputs contain a resistor and a capacitor, so the equation of this page describes them. A microcontroller that smooths a sensor with is running this circuit in code, at the cost of two multiplications per sample. You choose from the time constant you want with .
Later chapters build on this page. The filter that comes before a converter, to remove frequencies it cannot represent, is an analog circuit like this one; see Anti-aliasing and practical converters (10.4). Digital filters designed from analog circuits start from the equations here, in Analog prototype filters (20.1) and IIR design by the bilinear transform (20.2). And The Laplace transform (9.1), which turns and a differential equation into algebra, extends the “try ” step of the natural part.
The next page, First- and second-order systems (6.3), takes the spring above and puts numbers on its swing.
The maths behind it · eigenfunctions and null spaces
The function is an eigenfunction of : its derivative is times itself. That is why trying in a linear equation with constant coefficients turns calculus into a polynomial in . The natural part solves the free equation, which is the null space of the operator. The forced part is one particular solution, and every solution is a particular one plus a null-space one, exactly as for . A second-order equation is a system with a matrix, and its eigenvalues are those values of .
The maths behind it · the exponential distribution
The charging curve is the cumulative distribution function of the exponential distribution, the probability that a random waiting time is at most . Its mean waiting time is . So % of the waits are shorter than the mean, the same percentage as one time constant.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| RC circuit (voltage across ) | slope = (target − )/; | |
| Time constant | the starting tangent reaches the target at ; 63.2 % of the gap in | |
| Step response | 63.2, 86.5, 95.0, 98.2, 99.3 % at to ; never exactly 100 % | |
| Impulse response | as in 5.3 | |
| Time to share of the final value | undoes ; 90 % at | |
| Natural and forced | forced: slope zero, . Natural: , minus the gap; from | |
| Two cuts of one answer | natural plus forced, or zero-input plus zero-state | same total, different pieces |
| Mass, spring, damper | ||
| Series RLC (across ) | , , | |
| Discrete copy | , | for an input held over each interval; first stem at |