Skip to content
LumenaryAcademy
Circuits 60 min

RLC circuits and resonance

Put a capacitor and an inductor in one circuit and energy sloshes between them. The circuit rings, settles or resonates, and one number, the damping ratio, says which.

Code tested · 6AI-draftedAwaiting review by an electrical engineer

Your guides: Chloe · The Physicist, Margaret · The Bench Engineer, Gideon · The Design Reviewer

MotivationH

Circuits that ring

In Capacitors and inductors each energy store was paired with a resistor, and every response was a single exponential: the voltage crept towards its final value with time constant τ=RC\tau = RC or L/RL/R and never went past it. Put a capacitor and an inductor in the same circuit and something new happens. The capacitor's stored charge drives a current through the inductor; the inductor, which resists any change in current, keeps that current flowing after the capacitor is empty and charges it the other way; and the energy sloshes back and forth, a little smaller each time, until the resistance has turned it all into heat.

That sloshing, and its driven counterpart, resonance, are everywhere in electrical engineering:

  • A radio picks one station out of hundreds because an inductor and a capacitor respond strongly at one frequency and weakly at all others. Wireless phone chargers, contactless payment cards and the coils of MRI scanners are tuned the same way.
  • The quartz crystal that keeps time in a watch or a microcontroller behaves electrically like an RLC circuit with an extraordinarily small resistance.
  • A fast digital signal on a circuit board rings after every edge, overshooting its logic level, because the wires have inductance and the pins have capacitance. Too much ringing corrupts data or damages inputs.
  • The inductor and capacitor that smooth the output of a switching power supply form an RLC circuit whose damping decides whether the output voltage settles cleanly after a load change.

All of these obey one second-order differential equation. This lesson derives it, solves it exactly, simulates it numerically, and then drives it with a sinusoid to find resonance.

IntuitionH

Energy sloshing between two stores

Start with no resistor at all: a capacitor charged to some voltage, connected across an inductor. At first the capacitor's energy 12Cv2\tfrac12 C v^2 pushes current into the inductor, and the current grows. When the capacitor is empty, all the energy is in the inductor's magnetic field, 12Li2\tfrac12 L i^2, and the current is at its largest. The inductor will not let the current stop suddenly, so it keeps flowing and charges the capacitor with the opposite polarity. Then the whole process runs in reverse. Without resistance this would go on forever, a perfect electrical oscillator at the frequency ω0=1/LC\omega_0 = 1/\sqrt{LC}.

A resistor takes a bite of energy every cycle. A small resistance lets the oscillation ring for many cycles while it decays. A large one damps it so heavily that the voltage never swings past its final value at all. Between the two lies one special resistance, where the circuit settles without overshoot as quickly as any non-overshooting response can.

Analogy, not a formal construction

A mass on a spring, moving through air, water or honey, is the same system. The inductor is the mass: just as a force is needed to change a mass's velocity (F=m dv/dtF = m\,dv/dt), a voltage is needed to change an inductor's current (v=L di/dtv = L\,di/dt). The capacitor is the spring: it stores energy in how far it has been "stretched", which is its charge, and 1/C1/C plays the role of stiffness. The resistor is the friction of the fluid. In air the mass bounces for a long time; in honey it oozes back to rest without overshooting.

+−vsRLC+vC−iis+v−RLCseries RLCparallel RLC
The two classic second-order circuits. Left: a series RLC circuit driven by a voltage source; one current i flows through all three parts, and we watch the capacitor voltage v_C. Right: a parallel RLC circuit driven by a current source; all three parts share one voltage v.
DefinitionsH

The second-order equation

Take the series circuit first. Kirchhoff's voltage law round the loop, with the capacitor law i=C dvC/dti = C\,dv_C/dt substituted for the current, gives

vs(t)=Ri+Ldidt+vC⟹LC d2vCdt2+RC dvCdt+vC=vs(t).v_s(t) = Ri + L\frac{di}{dt} + v_C \quad\Longrightarrow\quad LC\,\frac{d^2 v_C}{dt^2} + RC\,\frac{dv_C}{dt} + v_C = v_s(t).

Now the parallel circuit. Kirchhoff's current law at the top node, with v=L diL/dtv = L\,di_L/dt for the inductor, gives

vR+iL+Cdvdt=is(t)⟹LC d2iLdt2+LR diLdt+iL=is(t).\frac{v}{R} + i_L + C\frac{dv}{dt} = i_s(t) \quad\Longrightarrow\quad LC\,\frac{d^2 i_L}{dt^2} + \frac{L}{R}\,\frac{di_L}{dt} + i_L = i_s(t).

Both are the same equation in disguise. Dividing by LCLC puts each into the standard form that engineers, physicists and mathematicians all use:

x¨+2ζω0 x˙+ω02 x=ω02 u(t),\ddot x + 2\zeta\omega_0\,\dot x + \omega_0^2\,x = \omega_0^2\,u(t),

where xx is the capacitor voltage (series) or the inductor current (parallel), uu is the source, and the dots mean time derivatives.

Definition— Natural frequency, damping ratio, quality factor

For an equation in standard form, ω0\omega_0 is the undamped natural frequency (in rad/s; divide by 2π2\pi for hertz), the frequency at which the circuit would oscillate with no resistance. ζ\zeta (zeta) is the damping ratio, a pure number. Two more quantities follow from them: the decay rate or neper frequency α=ζω0\alpha = \zeta\omega_0 (in s⁻¹), and the quality factor Q=1/(2ζ)Q = 1/(2\zeta). For the two circuits:

Series RLCParallel RLC
natural frequency ω0\omega_01/LC1/\sqrt{LC}1/LC1/\sqrt{LC}
decay rate α\alphaR/(2L)R/(2L)1/(2RC)1/(2RC)
damping ratio ζ\zetaR2CL\dfrac{R}{2}\sqrt{\dfrac{C}{L}}12RLC\dfrac{1}{2R}\sqrt{\dfrac{L}{C}}
quality factor QQ1RLC=ω0LR\dfrac{1}{R}\sqrt{\dfrac{L}{C}} = \dfrac{\omega_0 L}{R}RCL=ω0RCR\sqrt{\dfrac{C}{L}} = \omega_0 RC
more resistance meansmore dampingless damping

The quantity L/C\sqrt{L/C} has units of ohms (a henry is a volt-second per ampere, a farad an ampere-second per volt) and is called the circuit's characteristic impedance. Damping is a comparison of RR with it. In the series circuit, current flows through the resistor, so a big RR dissipates a lot. In the parallel circuit, a big RR is nearly an open circuit that takes almost no current, so it dissipates little, and the circuit rings longer.

Worked examplesH

Three kinds of response

To solve the equation we need the roots of its characteristic polynomial, and these may be complex. Electrical engineers write jj for the imaginary unit, j2=−1j^2 = -1, because the letter ii is already taken by current. (Lumenary Math's Complex numbers covers everything used here, including Euler's formula ejθ=cos⁡θ+jsin⁡θe^{j\theta} = \cos\theta + j\sin\theta.)

Theorem— The three responses of a second-order circuit

Let ω0>0\omega_0 > 0 and ζ≥0\zeta \ge 0. Every solution of x¨+2ζω0x˙+ω02x=0\ddot x + 2\zeta\omega_0\dot x + \omega_0^2 x = 0 has one of three forms, according to ζ\zeta. With α=ζω0\alpha = \zeta\omega_0:

  • Overdamped, ζ>1\zeta > 1: x(t)=Aes1t+Bes2tx(t) = A e^{s_1 t} + B e^{s_2 t}, where s1,2=−α±α2−ω02s_{1,2} = -\alpha \pm \sqrt{\alpha^2 - \omega_0^2} are distinct, real and negative.
  • Critically damped, ζ=1\zeta = 1: x(t)=(A+Bt) e−ω0tx(t) = (A + Bt)\,e^{-\omega_0 t}.
  • Underdamped, 0≤ζ<10 \le \zeta < 1: x(t)=e−αt(Acos⁡ωdt+Bsin⁡ωdt)x(t) = e^{-\alpha t}\left(A\cos\omega_d t + B\sin\omega_d t\right), where ωd=ω01−ζ2\omega_d = \omega_0\sqrt{1 - \zeta^2} is the damped natural frequency.

The constants AA and BB are fixed by x(0)x(0) and x˙(0)\dot x(0). If ζ>0\zeta > 0, every solution decays to zero.

Proof

Try x=estx = e^{st}. Substituting gives (s2+2ζω0s+ω02) est=0(s^2 + 2\zeta\omega_0 s + \omega_0^2)\,e^{st} = 0, so ss must be a root of the characteristic polynomial, s=−α±α2−ω02s = -\alpha \pm \sqrt{\alpha^2 - \omega_0^2}. If ζ>1\zeta > 1 the roots are real and distinct, and since α2−ω02<α\sqrt{\alpha^2 - \omega_0^2} < \alpha both are negative. If ζ=1\zeta = 1 there is one double root −ω0-\omega_0; because it is a root of the polynomial and of its derivative, te−ω0tt e^{-\omega_0 t} is a solution too, as direct substitution confirms. If ζ<1\zeta < 1 the roots are the complex pair −α±jωd-\alpha \pm j\omega_d, and by Euler's formula e(−α+jωd)t=e−αt(cos⁡ωdt+jsin⁡ωdt)e^{(-\alpha + j\omega_d)t} = e^{-\alpha t}(\cos\omega_d t + j\sin\omega_d t); since the equation has real coefficients, the real and imaginary parts of a solution are themselves solutions. In each case we have two independent solutions, and a linear second-order equation has exactly a two-dimensional family of solutions, one for each choice of x(0)x(0) and x˙(0)\dot x(0), so these are all of them. Finally, when ζ>0\zeta > 0 every exponent has a negative real part, so every solution decays.

∎

The driven problem is then easy. Suppose the series circuit is at rest (vC=0v_C = 0, i=0i = 0) and a constant voltage VV is switched on at t=0t = 0. The final value is vC=Vv_C = V, so vC=V+x(t)v_C = V + x(t) with xx from the theorem, and the initial conditions vC(0)=0v_C(0) = 0 and v˙C(0)=i(0)/C=0\dot v_C(0) = i(0)/C = 0 fix AA and BB. The three step responses are

overdamped:vC(t)=V[1−s2es1t−s1es2ts2−s1],critically damped:vC(t)=V[1−(1+ω0t) e−ω0t],underdamped:vC(t)=V[1−e−αt(cos⁡ωdt+αωdsin⁡ωdt)].\begin{aligned} \text{overdamped:}\quad & v_C(t) = V\left[1 - \frac{s_2 e^{s_1 t} - s_1 e^{s_2 t}}{s_2 - s_1}\right],\\ \text{critically damped:}\quad & v_C(t) = V\left[1 - (1 + \omega_0 t)\,e^{-\omega_0 t}\right],\\ \text{underdamped:}\quad & v_C(t) = V\left[1 - e^{-\alpha t}\left(\cos\omega_d t + \frac{\alpha}{\omega_d}\sin\omega_d t\right)\right]. \end{aligned}

Differentiating the underdamped one gives the current, i(t)=VωdL e−αtsin⁡ωdti(t) = \dfrac{V}{\omega_d L}\,e^{-\alpha t}\sin\omega_d t. It first returns to zero at tp=π/ωdt_p = \pi/\omega_d, and that is where vCv_C peaks. Substituting tpt_p gives the overshoot, the fraction by which the peak exceeds VV:

overshoot=e−απ/ωd=exp⁡ ⁣(−πζ1−ζ2).\text{overshoot} = e^{-\alpha\pi/\omega_d} = \exp\!\left(\frac{-\pi\zeta}{\sqrt{1 - \zeta^2}}\right).

It depends on ζ\zeta alone: about 73% at ζ=0.1\zeta = 0.1, 16% at ζ=0.5\zeta = 0.5, 4.3% at ζ=1/2≈0.707\zeta = 1/\sqrt2 \approx 0.707, and none at ζ≥1\zeta \ge 1.

Example— A 1 mH, 1 µF series circuit

Take L=1 mHL = 1\ \text{mH} and C=1 μFC = 1\ \mu\text{F}, driven by a 5 V step. Then ω0=1/10−9=31 623\omega_0 = 1/\sqrt{10^{-9}} = 31\,623 rad/s, so f0=5033f_0 = 5033 Hz, and L/C=31.6 Ω\sqrt{L/C} = 31.6\ \Omega. Critical damping (ζ=1\zeta = 1) needs R=2L/C=63.2 ΩR = 2\sqrt{L/C} = 63.2\ \Omega.

With R=20 ΩR = 20\ \Omega: ζ=20/63.2=0.316\zeta = 20/63.2 = 0.316, so the circuit is underdamped. The decay rate is α=R/(2L)=10 000 s−1\alpha = R/(2L) = 10\,000\ \text{s}^{-1}, and ωd2=ω02−α2=109−108=9×108\omega_d^2 = \omega_0^2 - \alpha^2 = 10^9 - 10^8 = 9 \times 10^8, so ωd=30 000\omega_d = 30\,000 rad/s exactly, a ringing frequency of 30 000/2π=477530\,000/2\pi = 4775 Hz, about 5% below f0f_0. The voltage peaks at tp=π/30 000=104.7 μst_p = \pi/30\,000 = 104.7\ \mu\text{s} with overshoot e−π/3=0.351e^{-\pi/3} = 0.351, so it reaches 5×1.351=6.755 \times 1.351 = 6.75 V before settling back. The ringing envelope e−αte^{-\alpha t} falls below 2% when αt=ln⁡50≈3.9\alpha t = \ln 50 \approx 3.9, about 390 µs after the step.

With R=200 ΩR = 200\ \Omega: ζ=3.16\zeta = 3.16, overdamped. The roots are s1=−5132 s−1s_1 = -5132\ \text{s}^{-1} and s2=−194 868 s−1s_2 = -194\,868\ \text{s}^{-1}. The fast root dies out within a few microseconds; the slow one, with time constant 1/5132≈195 μs1/5132 \approx 195\ \mu\text{s}, sets how long you wait.

0100200300400500600time after the step (µs)0 V5 Vfinal valuepeak 6.75 V at 104.7 µsunderdamped, R = 20 Ωcritical, R = 63.2 Ωoverdamped, R = 200 Ω
Step responses of the 1 mH, 1 µF series circuit to a 5 V step, for three resistances. The underdamped circuit (R = 20 Ω, ζ = 0.32) is fastest to rise but overshoots to 6.75 V and rings; the critically damped one (R = 63.2 Ω) is the fastest that never overshoots; the overdamped one (R = 200 Ω) creeps up slowly.
ComputationC

Simulating the circuit

Exact solutions exist only for simple circuits. Add a diode, a second inductor or a time-varying source and you must integrate numerically, which is what every circuit simulator does. To integrate, write the second-order equation as two first-order ones in the state (vC,i)(v_C, i), the two quantities that hold the circuit's energy:

dvCdt=iC,didt=vs−Ri−vCL.\frac{dv_C}{dt} = \frac{i}{C}, \qquad \frac{di}{dt} = \frac{v_s - Ri - v_C}{L}.

The program below integrates these with the classical fourth-order Runge–Kutta method (RK4; see Lumenary Math's Numerical methods), which samples the slope four times per step and combines the samples so that the error per unit time shrinks like h4h^4 in the step hh. It runs the 1 mH, 1 µF circuit at the three resistances of the figure and checks every point against the exact formulas.

python
import numpy as np

L, C, V = 1e-3, 1e-6, 5.0          # 1 mH, 1 uF, and a 5 V step at t = 0
w0 = 1 / np.sqrt(L * C)
R_crit = 2 * np.sqrt(L / C)

def exact(R, t):
    """Capacitor voltage of a series RLC after a step, starting from rest."""
    a = R / (2 * L)                                    # alpha = zeta * w0
    if np.isclose(a, w0):                              # critically damped
        return V * (1 - (1 + w0 * t) * np.exp(-w0 * t))
    if a > w0:                                         # overdamped: two real roots
        r = np.sqrt(a * a - w0 * w0)
        s1, s2 = -a + r, -a - r
        return V * (1 - (s2 * np.exp(s1 * t) - s1 * np.exp(s2 * t)) / (s2 - s1))
    wd = np.sqrt(w0 * w0 - a * a)                      # underdamped: complex pair
    return V * (1 - np.exp(-a * t) * (np.cos(wd * t) + a / wd * np.sin(wd * t)))

def rk4(R, h, t_end):
    """Integrate the state x = [v_C, i] with the classical Runge-Kutta method."""
    def f(x):
        v, i = x
        return np.array([i / C, (V - R * i - v) / L])
    n = round(t_end / h)
    x = np.zeros(2)
    vs = [0.0]
    for _ in range(n):
        k1 = f(x)
        k2 = f(x + h / 2 * k1)
        k3 = f(x + h / 2 * k2)
        k4 = f(x + h * k3)
        x = x + h / 6 * (k1 + 2 * k2 + 2 * k3 + k4)
        vs.append(x[0])
    return np.arange(n + 1) * h, np.array(vs)

print(f"w0 = {w0:.0f} rad/s (f0 = {w0 / (2 * np.pi):.1f} Hz), critical R = {R_crit:.2f} ohm\n")
cases = [("overdamped", 200.0), ("critical", R_crit), ("underdamped", 20.0)]
runs = {name: rk4(R, 1e-6, 1e-3) for name, R in cases}

print("t (us)  " + "".join(f"{name:>13}" for name, _ in cases))
for k in (0, 25, 50, 100, 150, 200, 300, 400, 600, 1000):
    print(f"{k:6d}  " + "".join(f"{runs[name][1][k]:11.4f} V" for name, _ in cases))
print("\nlargest |RK4 - exact| over 1 ms:")
for name, R in cases:
    t, v = runs[name]
    print(f"  {name:12} zeta = {R / R_crit:5.3f}   {np.abs(v - exact(R, t)).max():.1e} V")

# Fourth order: halving the step should divide the error by about 2**4 = 16.
print()
for h in (20e-6, 10e-6, 5e-6, 2.5e-6):
    t, v = rk4(20.0, h, 1e-3)
    print(f"underdamped, h = {h * 1e6:4.1f} us: max error = {np.abs(v - exact(20.0, t)).max():.2e} V")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The table tells the same story as the figure. At 100 µs the underdamped circuit is already at 6.73 V, past its target; the critically damped one is at 4.12 V and closing in without overshoot; the overdamped one has reached only 1.93 V and is still 0.03 V short after a full millisecond. RK4 with a 1 µs step agrees with the exact solutions to better than a microvolt. The last four lines show the fourth order directly: each halving of the step divides the error by about 16 (from 8.97×10−38.97 \times 10^{-3} to 5.44×10−45.44 \times 10^{-4} to 3.28×10−53.28 \times 10^{-5} to 2.02×10−62.02 \times 10^{-6} V).

Checking with SPICE

SPICE, the circuit simulator first written at Berkeley in the early 1970s, is how engineers check this kind of calculation. Its descendants, such as the open-source ngspice used here, read a netlist: one line per component, naming the nodes it connects. The netlist below applies a 5 V step (rising in 10 ns) to the R=20 ΩR = 20\ \Omega circuit, runs a transient analysis for 1 ms, and measures the peak, the time between the first and third crossings of 5 V (one full ringing period), and the final value.

spice
* Series RLC step response: 5 V step, R = 20 ohm, L = 1 mH, C = 1 uF
V1 in 0 PWL(0 0 10n 5)
R1 in a 20
L1 a b 1m
C1 b 0 1u
.control
tran 0.1u 1m 0 0.1u
meas tran vpeak MAX v(b)
meas tran tcross1 WHEN v(b)=5 CROSS=1
meas tran tcross3 WHEN v(b)=5 CROSS=3
let fd = 1/(tcross3 - tcross1)
print fd
meas tran vend FIND v(b) AT=1m
.endc
.end

ngspice prints (among its other messages):

text
vpeak               =  6.754601e+00 at=  1.046918e-04
tcross1             =  6.308993e-05
tcross3             =  2.725296e-04
fd = 4.774645e+03
vend                =  5.000040e+00

A peak of 6.7546 V at 104.7 µs and a ringing frequency of 4774.6 Hz, exactly as the hand calculation and the RK4 program predicted (the hand values are 6.7545 V, 104.7 µs and 30 000/2π=4774.630\,000/2\pi = 4774.6 Hz).

Worked examplesH

Resonance and Q

So far the source was a step. Now drive the series circuit with a sinusoid, vs=Vcos⁡ωtv_s = V\cos\omega t, and wait for the transient to die away. What remains is the sinusoidal steady state: every voltage and current oscillates at the source's frequency ω\omega, and only the amplitudes and timings are left to find.

A short calculation finds them, using a trick that the next lesson, AC circuits, phasors and impedance, turns into a general method. Since cos⁡ωt=Re⁡ejωt\cos\omega t = \operatorname{Re} e^{j\omega t}, look for a solution vC=Re⁡(Aejωt)v_C = \operatorname{Re}(A e^{j\omega t}) with a complex constant AA. Each time derivative just multiplies ejωte^{j\omega t} by jωj\omega, so the differential equation becomes an algebraic one:

(1−ω2LC+jωRC)A=V⟹∣A∣=V(1−ω2LC)2+(ωRC)2.\left(1 - \omega^2 LC + j\omega RC\right)A = V \quad\Longrightarrow\quad |A| = \frac{V}{\sqrt{(1 - \omega^2 LC)^2 + (\omega RC)^2}}.

The current is i=C dvC/dti = C\,dv_C/dt, of amplitude ωC∣A∣\omega C|A|, which simplifies to

∣I∣=VR2+(ωL−1ωC)2.|I| = \frac{V}{\sqrt{R^2 + \left(\omega L - \dfrac{1}{\omega C}\right)^2}}.

At ω=ω0=1/LC\omega = \omega_0 = 1/\sqrt{LC}, the term ωL−1/(ωC)\omega L - 1/(\omega C) vanishes: the inductor's and the capacitor's opposition to current cancel exactly, the current reaches its maximum V/RV/R, limited only by the resistance, and it is in step with the source.

Definition— Resonance, bandwidth, quality factor

A circuit is at resonance when it is driven at the frequency where its inductive and capacitive effects cancel; for the series and parallel RLC circuits this is ω0=1/LC\omega_0 = 1/\sqrt{LC}. The half-power points are the frequencies ω1<ω0<ω2\omega_1 < \omega_0 < \omega_2 at which the response amplitude has fallen to 1/21/\sqrt2 of its peak, so the power delivered has halved. The bandwidth is Δω=ω2−ω1\Delta\omega = \omega_2 - \omega_1, and the quality factor is

Q=ω0Δω.Q = \frac{\omega_0}{\Delta\omega}.

For the series circuit, setting ∣ωL−1/(ωC)∣=R|\omega L - 1/(\omega C)| = R gives a quadratic in ω\omega whose positive roots differ by exactly R/LR/L, so Q=ω0L/RQ = \omega_0 L/R, matching the table above, and Q=1/(2ζ)Q = 1/(2\zeta). The same Q has three other faces, all worth knowing:

  • Energy: Q=2π×energy storedenergy dissipated per cycleQ = 2\pi \times \dfrac{\text{energy stored}}{\text{energy dissipated per cycle}} at resonance. A high-Q circuit loses only a small fraction of its energy each cycle.
  • Ring-down: left to itself, a circuit's oscillation amplitude falls by a factor e−π≈0.04e^{-\pi} \approx 0.04 in about Q cycles. A bell with a high Q rings for a long time.
  • Magnification: at resonance the capacitor voltage has amplitude ∣VC∣=∣I∣/(ω0C)=V/(ω0RC)=QV|V_C| = |I|/(\omega_0 C) = V/(\omega_0 RC) = QV, and the inductor voltage has the same amplitude in the opposite direction. The two cancel in the loop, but each component really sees Q times the source voltage.

The program below checks all of this the way you would on a bench: it drives the 1 mH, 1 µF circuit, now with only 2 Ω of resistance, at nine frequencies, simulates 12 ms with RK4 until the transient has decayed, and records the largest current and capacitor voltage in the last 2 ms.

python
import math

L, C, R = 1e-3, 1e-6, 2.0          # the same L and C, now with only 2 ohm of resistance
V = 1.0                            # source amplitude: v_s(t) = 1 V * sin(w t)
w0 = 1 / math.sqrt(L * C)

def simulate(w, t_end=12e-3, h=1e-6):
    """RK4 on the driven circuit; return the largest |i| and |v_C| in the last 2 ms."""
    def f(t, v, i):
        return i / C, (V * math.sin(w * t) - R * i - v) / L
    t = v = i = 0.0
    i_max = v_max = 0.0
    for n in range(round(t_end / h)):
        a1, b1 = f(t, v, i)
        a2, b2 = f(t + h / 2, v + h / 2 * a1, i + h / 2 * b1)
        a3, b3 = f(t + h / 2, v + h / 2 * a2, i + h / 2 * b2)
        a4, b4 = f(t + h, v + h * a3, i + h * b3)
        v += h / 6 * (a1 + 2 * a2 + 2 * a3 + a4)
        i += h / 6 * (b1 + 2 * b2 + 2 * b3 + b4)
        t += h
        if t > t_end - 2e-3:                       # the transient has died away by now
            i_max, v_max = max(i_max, abs(i)), max(v_max, abs(v))
    return i_max, v_max

def formula(w):
    """Steady-state amplitudes from the complex-exponential trial solution."""
    i_amp = V / math.sqrt(R**2 + (w * L - 1 / (w * C))**2)
    return i_amp, i_amp / (w * C)

print(f"f0 = {w0 / (2 * math.pi):.1f} Hz,  Q = w0 L / R = {w0 * L / R:.2f}\n")
print("   f (Hz)   |i| sim (mA) formula   |v_C| sim (V) formula")
for ratio in (0.5, 0.8, 0.9, 0.95, 1.0, 1.05, 1.1, 1.25, 2.0):
    w = ratio * w0
    (i_s, v_s), (i_f, v_f) = simulate(w), formula(w)
    print(f"{w / (2 * math.pi):9.1f}   {1e3 * i_s:8.2f} {1e3 * i_f:8.2f}   {v_s:10.3f} {v_f:8.3f}")

# Half-power (-3 dB) points of the current: where |i| falls to 1/sqrt(2) of its peak.
a = R / (2 * L)
w_lo, w_hi = math.sqrt(a**2 + w0**2) - a, math.sqrt(a**2 + w0**2) + a
print(f"\nhalf-power points: {w_lo / (2 * math.pi):.1f} Hz and {w_hi / (2 * math.pi):.1f} Hz")
print(f"bandwidth = {(w_hi - w_lo) / (2 * math.pi):.1f} Hz,  f0 / bandwidth = {w0 / (w_hi - w_lo):.2f}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The simulation and the formula agree to within one unit in the last digit printed. At resonance a 1 V source pushes 500 mA through the circuit, limited only by the 2 Ω, and the capacitor swings to 15.81 V, which is Q = 15.81 times the source. Only 20% below resonance, at 0.8f00.8 f_0, the current is already down to 70 mA. The half-power points sit at 4876.3 Hz and 5194.6 Hz, a bandwidth of 318.3 Hz, and f0f_0 divided by that bandwidth is again 15.81.

Notice also that the currents at 0.5f00.5 f_0 and 2f02 f_0 are identical (21.06 mA), and so are those at 0.8f00.8 f_0 and 1.25f01.25 f_0. Replace ω\omega by ω02/ω\omega_0^2/\omega and the reactance ωL−1/(ωC)\omega L - 1/(\omega C) only changes sign, so ∣I∣|I| is unchanged: the current response is symmetric on a logarithmic frequency axis, which is one reason engineers plot frequency responses that way, as Frequency response, Bode plots and filters will.

Example— Tuning a medium-wave radio

Medium-wave AM broadcasting spans roughly 530 to 1700 kHz, with stations 9 kHz apart in most of the world and 10 kHz apart in the Americas. A receiver's first tuned circuit with a 220 µH coil reaches 1 MHz with C=1/(ω2L)=115C = 1/(\omega^2 L) = 115 pF. To sweep from 531 kHz to 1602 kHz the variable capacitor must run from 408 pF down to 45 pF: since f0∝1/Cf_0 \propto 1/\sqrt C, a frequency ratio of about 3 needs a capacitance ratio of about 9. For a bandwidth of one channel, 9 kHz at 1 MHz, the circuit needs Q=106/9000≈111Q = 10^6/9000 \approx 111. A single coil-and-capacitor circuit can just about manage that, which is why early receivers had several tuned stages, and why nearly every receiver since the 1930s has used the superheterodyne design that does most of its filtering at one fixed frequency (more in Modulation).

ExplanationH

Where RLC circuits appear

Tuned circuits. Besides radio receivers, resonant LC circuits set the operating frequency of contactless cards and NFC tags (13.56 MHz), of inductive phone chargers built to the Wireless Power Consortium's Qi standard (of the order of 100 kHz), and of the radio-frequency coils of MRI scanners, which must resonate at the frequency at which hydrogen nuclei precess in the magnet: about 64 MHz in a 1.5-tesla scanner. In each, the designer chooses Q: high enough to select the right frequency or transfer power efficiently, low enough that component tolerances and temperature drift do not detune it.

Crystals and resonators. A quartz crystal vibrates mechanically, and through the piezoelectric effect it looks to the circuit like a series RLC (with a capacitor in parallel) whose Q is in the tens of thousands or more. That is why a 32.768 kHz watch crystal keeps time to seconds per month. Feedback and oscillators shows how an amplifier keeps such a resonator ringing forever.

Ringing on digital lines. A logic output switching in a fraction of a nanosecond drives the inductance of its package and the trace, into the capacitance of the trace and the receiving pins. As long as the trace is short compared with the distance a signal travels during the edge, this is a lumped series RLC circuit, and its resistance is just the driver's output resistance, often far below critical. The cure is a small series termination resistor next to the driver. The program below models a 3.3 V output with 10 Ω of drive resistance, 10 nH of inductance and 10 pF of load, and tries standard resistor values.

python
import numpy as np

# A 3.3 V logic output driving a short trace and a few input pins, as a lumped series RLC.
L = 10e-9          # package lead, bond wire and trace inductance: 10 nH
C = 10e-12         # trace and input-pin capacitance: 10 pF
R_drv = 10.0       # the driver's own output resistance
V = 3.3

w0 = 1 / np.sqrt(L * C)
R_crit = 2 * np.sqrt(L / C)
print(f"f0 = {w0 / 2 / np.pi / 1e6:.0f} MHz; critical damping needs {R_crit:.1f} ohm in total\n")

def step(R, t):
    a = R / (2 * L)
    if np.isclose(a, w0):
        return V * (1 - (1 + w0 * t) * np.exp(-w0 * t))
    if a > w0:
        r = np.sqrt(a * a - w0 * w0)
        s1, s2 = -a + r, -a - r
        return V * (1 - (s2 * np.exp(s1 * t) - s1 * np.exp(s2 * t)) / (s2 - s1))
    wd = np.sqrt(w0 * w0 - a * a)
    return V * (1 - np.exp(-a * t) * (np.cos(wd * t) + a / wd * np.sin(wd * t)))

t = np.linspace(0, 20e-9, 200001)      # 0 to 20 ns in 0.1 ps steps
print("added R   zeta  peak (V)  overshoot  10-90% rise  within 2% after")
for R_s in (0, 10, 22, 33, 47, R_crit - R_drv, 68):
    R = R_drv + R_s
    v = step(R, t)
    zeta = R / R_crit
    rise = t[np.argmax(v >= 0.9 * V)] - t[np.argmax(v >= 0.1 * V)]
    outside = np.nonzero(np.abs(v - V) > 0.02 * V)[0]
    settle = t[outside[-1] + 1]
    over = max(0.0, 100 * (v.max() / V - 1))
    print(f"{R_s:5.1f} ohm {zeta:5.2f}  {v.max():7.2f}  {over:7.1f} %  "
          f"{rise * 1e9:7.2f} ns  {settle * 1e9:9.2f} ns")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

With no added resistor, ζ=0.16\zeta = 0.16 and the 3.3 V output rings at 503 MHz up to 5.30 V, a 60.5% overshoot that would exceed the absolute maximum input voltage of most 3.3 V parts and could be read as two edges instead of one. A 33 Ω resistor brings the overshoot to 5.4%; 47 Ω (ζ=0.90\zeta = 0.90) to 0.1%. Each step up slows the rise (from 0.37 ns to 1.44 ns across the table), the price of damping. Real designs predict this with simulators fed by the chip makers' IBIS models of their output buffers. When a trace is long enough that the edge is over before the signal reaches the far end, the lumped model fails and the trace must be treated as a transmission line (Transmission lines), but the cure, a resistor matched to the line, is close kin to this one.

LC filters in power supplies. A switching regulator chops its input into pulses at hundreds of kilohertz and smooths them with an inductor and a capacitor, a second-order low-pass filter whose damping comes mostly from the load and the capacitor's small internal resistance. Too little damping and the output rings after every load step; an input filter with too little damping can even interact with the regulator and make it oscillate, a problem analysed in a classic 1976 paper by R. D. Middlebrook. Power electronics returns to this.

Power distribution on chips and boards. A processor's supply is decoupled by many capacitors, each with a little series inductance, connected through the inductance of the package and the board. Between them these form parallel resonances, and at those frequencies the supply's impedance can peak, letting current pulses from the chip shake the supply voltage. Designers choose capacitor values and their small series resistances to keep the impedance below a target across the whole band; Printed circuit boards shows how.

Common misconceptionsH

Common misconceptions

Misconception

"Critical damping always settles fastest." It is the fastest response that never overshoots. If a small overshoot is acceptable, a slightly underdamped circuit gets inside a tolerance band sooner: in the digital-line table, ζ=0.90\zeta = 0.90 settled within 2% after 1.49 ns, and critical damping took 1.84 ns. That is why control and filter designers often aim for ζ\zeta between about 0.6 and 0.9 rather than exactly 1.

Misconception

"At resonance the current becomes infinite." Only in a circuit with no resistance, which does not exist. At resonance the inductor and capacitor cancel each other, so the current is limited by the resistance alone, V/RV/R. What does become large is the voltage across the inductor and the capacitor separately, Q times the source.

Misconception

"A higher Q is always better." A high Q means a narrow bandwidth, a long ring-down and great sensitivity to component values. With Q = 100 the bandwidth is 1% of f0f_0, but a 5% capacitor shifts f0f_0 by about 2.5%, so the circuit may miss the frequency it was meant to select. Filters, sensors and power circuits are often designed for a deliberately modest Q.

Misconception

"Adding resistance always adds damping." Only in series. In the parallel circuit, ζ=12RL/C\zeta = \frac{1}{2R}\sqrt{L/C}, so a larger resistance means less damping, and an open circuit (R→∞R \to \infty) means none.

Misconception

"The ringing frequency is the resonant frequency." They differ: a step response rings at ωd=ω01−ζ2\omega_d = \omega_0\sqrt{1-\zeta^2}, which was 4775 Hz against f0=5033f_0 = 5033 Hz in our example. (The peak of the capacitor-voltage response to a sinusoid lies lower again, at ω01−2ζ2\omega_0\sqrt{1 - 2\zeta^2}.) All three coincide only as ζ→0\zeta \to 0.

History & global context

A short history

In 1853 William Thomson, later Lord Kelvin, analysed the discharge of a Leyden jar (an early capacitor) through a coil and showed that when the resistance is small enough the discharge oscillates, which is the underdamped case of this lesson. A few years later Wilhelm Feddersen photographed such sparks in a rotating mirror and saw the oscillations. Heinrich Hertz used spark-driven resonant circuits in 1886–88 to generate and detect the electromagnetic waves Maxwell had predicted. Within a decade Oliver Lodge and Guglielmo Marconi were patenting ways to tune transmitters and receivers to each other so that several stations could share the air, and the tuned LC circuit became the heart of radio. The same mathematics describes swinging pendulums, ringing bells and vibrating bridges, and Lumenary Math's Ordinary differential equations and Classical mechanics treat those. Robotics makes the analogy run the other way: impedance control deliberately makes a robot arm behave like a chosen mass, spring and damper.

Exercises

Exercises

1. RLC circuits and resonance

Warm-upHuman

A 100 Ω resistor, a 10 mH inductor and a 100 nF capacitor are connected first in series (driven by a voltage source) and then in parallel (driven by a current source). What kind of response does each circuit have?

Choose one

2. RLC circuits and resonance

Warm-upHuman

A 33 µH inductor and a 330 nF capacitor form a resonant circuit. What is its resonant frequency f0f_0, in kilohertz, rounded to the nearest whole kHz?

3. RLC circuits and resonance

CoreHuman

A series circuit has L=1L = 1 mH, C=1 μC = 1\ \muF and R=31.6 ΩR = 31.6\ \Omega, and is at rest when a 10 V step is applied. By what percentage does the capacitor voltage overshoot 10 V at its peak? Give a whole-number percentage.

4. RLC circuits and resonance

CoreHuman

In the Americas, medium-wave AM stations are 10 kHz apart. A tuned circuit for a station at 1200 kHz should have a half-power bandwidth of 10 kHz. What quality factor Q does it need? (Give a whole number.)

5. RLC circuits and resonance

CoreHuman

A logic output with 12 Ω output resistance drives a short trace modelled as 5 nH of series inductance and 20 pF of load capacitance. What is the smallest whole number of ohms you can add as a series resistor at the driver so that the step response does not overshoot at all?

6. RLC circuits and resonance

CoreHuman

You probe a 3.3 V clock signal using the long ground clip that came with your oscilloscope probe, and every edge shows ringing at about 130 MHz. When you replace the clip with a short spring contact at the probe tip, most of the ringing disappears. What is the most likely explanation?

Choose one

7. RLC circuits and resonance

CoreComputational

Write rlc_parameters(R, L, C, topology) that returns the tuple (f0, zeta, Q) for an RLC circuit: the undamped natural frequency in hertz, the damping ratio and the quality factor. topology is "series" (the default) or "parallel". Raise ValueError for any other topology.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

8. RLC circuits and resonance

StretchComputational

Write step_response(R, L, C, V, t): the capacitor voltage of a series RLC circuit, at rest until a step of V volts is applied at t=0t = 0, evaluated at every time in the NumPy array t. It must work in all three regimes — overdamped, critically damped and underdamped — including the case where the circuit is exactly critically damped. The tests compare your function with a Runge–Kutta simulation for six circuits.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources

  • MIT OpenCourseWare 6.002: Circuits and Electronics · Anant Agarwal · 2007Free lectures and notes, including second-order circuits and resonance.
  • The Feynman Lectures on Physics, Volume I, chapter 23: Resonance · Richard P. Feynman, Robert B. Leighton and Matthew SandsThe driven, damped oscillator, mechanical and electrical, worked out with complex numbers.
  • ngspice documentationThe manual of the open-source simulator used for the SPICE check in this lesson.
  • IBIS Open ForumThe industry standard for the I/O buffer models that signal-integrity tools use to predict ringing on real boards.
  • On transient electric currents · William Thomson (Lord Kelvin) · 1853The first analysis of when a discharging capacitor oscillates, which is the underdamped case of this lesson.