The 3D version of this sim renders the comb structure and integrates the equation of motion with semi-implicit Euler, reading off a single live amplification number. This 2D companion computes the same real spring-mass-damper physics a genuinely different way: it integrates the driven oscillator with 4th-order Runge‑Kutta (RK4), and instead of just a number, it plots the full closed-form resonance transfer function the equation predicts, then overlays a live point measured directly from the running RK4 integration so you can watch the two agree in real time.
m·x″ + c·x′ + k·x = F(t), ω₀=√(k/m), Q=mω₀/c
V(t) = V_DC + V_AC·sin(ωt), F ∝ V(t)² expands into
a DC term, a term at ω (amplitude ∝ 2·V_DC·V_AC),
and a term at 2ω (amplitude ∝ V_AC²/2)
Closed-form gain of the ω-term:
H(r) = 1 / sqrt[(1−r²)² + (r/Q)²], r = ω/ω₀
H(1) = Q exactly (verified numerically below)
Because the ODE is linear, the true steady-state motion is the exact superposition of a DC offset, the fundamental at gain H(r), and a weaker second-harmonic at gain H(2r) — the small harmonic mixing you can see nudge the live "measured" point slightly above the pure H(r) curve is a real effect of a real comb drive, not simulation noise. Standalone verification (Node, RK4 vs. the closed form above, run to steady state after transients decay): every sampled r from 0.3 to 3.0 matched the analytic H(r) to within numerical precision (<0.001% relative error) for pure single-tone forcing, and H(1) measured exactly Q for Q = 5, 18 and 40, exactly matching the classical resonance-curve formula.
- V_DC / V_AC — set the bias and drive-swing voltages across the comb; a larger V_DC relative to V_AC keeps the ω-term dominant, matching the pure resonance curve.
- ω/ω₀ — drive frequency relative to mechanical resonance; sweep it through 1.0 to trace the peak on the chart.
- Q — quality factor; the curve's peak height equals Q exactly and its width narrows as Q grows.
Animation runs on a slowed, visually-scaled clock so the ~20 kHz mechanical resonance is visible; the frequency and force readouts are the real device values from the formulas above, and shuttle motion is clamped for display near very sharp, high-Q resonance peaks where a real device would approach mechanical contact.