From audio electronics to biomedical sensors, RC low‑pass filters tame rapid fluctuations while letting slower trends pass. A resistor and capacitor may appear humble, yet together they embody fundamental principles of energy storage and dissipation. Traditional cutoff calculators provide a single frequency, but they rarely show how the circuit actually reshapes a signal or partitions energy between the capacitor and resistor. The simulator above keeps the familiar cutoff computation while adding a live time‑domain model. As you adjust resistance, capacitance, or the input frequency, the canvas traces both the driving sine wave and the filtered response. Energy bars beneath the plot reveal how much energy temporarily resides in the capacitor and how much has been dissipated as heat in the resistor. This blend of math and motion turns an abstract transfer function into an intuitive experiment that runs directly in your browser.
The filter consists of a series resistor and a shunt capacitor connected to ground, with the output taken across the capacitor. The driving input is a sinusoid of amplitude and frequency . The differential equation governing the capacitor voltage is . Inputs expect SI units: ohms, microfarads (converted internally to farads), volts, and hertz. The simulation clamps the time step between 0.0001 and 0.05 s for stability. Parasitic inductances, non‑linear components, and source impedance are neglected; the resistor is assumed to dissipate all non‑stored energy as heat. A constant air temperature is implied so that resistor heating does not change resistance. Because the model focuses on sine waves, it does not capture transient effects like step responses unless you choose very low frequencies relative to the simulation length. Nevertheless, the approach illuminates how attenuation and phase shift arise from first principles.
The transfer function magnitude of a first‑order RC low‑pass filter is , and its phase shift is . The cutoff frequency occurs at , where the magnitude drops to . To animate the filter’s time response, we integrate the capacitor equation directly. The instantaneous capacitor energy is . Power dissipated in the resistor is . The simulation integrates over time to track energy loss. These quantities feed the striped bars beneath the canvas, providing a color‑independent gauge of storage versus dissipation.
The capacitor ODE is advanced with a fourth‑order Runge–Kutta algorithm. For state variable and derivative function , the update is . RK4’s stability permits relatively large steps compared with explicit Euler, but the interface still restricts so that at least 20 samples resolve each input period. Upon each input change the simulator recomputes the entire trajectory for two periods of the driving frequency. The pre‑computed arrays allow smooth animation independent of browser frame rate. If is zero, the program substitutes a DC step and integrates for a fixed interval, illustrating the familiar exponential charging curve.
Take the default values: , , , and . The cutoff frequency computes to kHz, well above the driving frequency. Press Play and the output sinusoid (orange) almost overlaps the input (gray dashed) with negligible phase lag. The capacitor bar oscillates slightly as energy sloshes in and out, while the resistor bar remains tiny, signifying little dissipation. Increase the frequency to 2 kHz and rerun: the output amplitude shrinks to about 0.01 V and the phase lags nearly 90°, clearly visible as the orange wave shifts relative to the gray. The resistor bar now dominates, showing that most input energy converts to heat rather than stored charge. Exporting the CSV file yields time, input, output, capacitor energy, and dissipated energy for further analysis.
The table compares three configurations after one period of simulation, underscoring how component values shape behavior.
R (Ω) | C (µF) | f (Hz) | |H| | Phase (deg) |
---|---|---|---|---|
1k | 0.1 | 50 | 0.999 | -0.3 |
1k | 0.1 | 2000 | 0.010 | -88.6 |
10k | 0.01 | 2000 | 0.044 | -77.5 |
The near‑unity magnitude and tiny phase shift of the first row confirm that low frequencies pass unscathed. At 2 kHz the same components barely transmit any signal, and phase approaches the -90° limit. Increasing resistance while reducing capacitance yields an intermediate attenuation and phase, illustrating design trade‑offs. You can reproduce each row by entering the values and inspecting the caption, which reports instantaneous amplitude and phase calculated from the simulation data.
The canvas horizontally represents time over two periods of the input signal. The vertical scale adjusts automatically to fit the greater of the input or output amplitudes. The gray dashed curve shows the source voltage, while the solid orange curve traces the capacitor voltage. A blue bar underneath indicates energy stored in the capacitor; an orange bar tracks cumulative energy dissipated in the resistor, both using striped textures for color‑independent cues. The caption and hidden text summary provide time, instantaneous input and output voltages, and energy values so screen‑reader users experience the same information. Keyboard focus on the canvas followed by the space bar toggles play and pause, enabling accessible control.
This idealized model omits source impedance, capacitor leakage, dielectric absorption, and resistor temperature dependence. At very high frequencies the assumption of lumped elements fails as lead inductances and stray capacitances introduce resonances. The sinusoidal source has zero internal resistance, so it can deliver any required current without droop; real generators have finite output impedance. Numerical integration assumes the waveform is well resolved; using a time step that yields fewer than 20 samples per period can produce visible aliasing or energy‑accounting errors. Additionally, the energy calculation treats the resistor as purely dissipative, ignoring electromagnetic radiation that would arise in high‑frequency circuits. Despite these simplifications, the simulator captures the essential physics of first‑order filtering.
Future enhancements might add a step‑response mode, frequency sweep generator, or Bode magnitude plot to bridge time‑ and frequency‑domain perspectives. Cascading multiple RC sections could reveal how higher‑order filters steepen attenuation. Including an optional series resistor at the source would demonstrate voltage divider effects and the importance of impedance matching. On the pedagogical front, overlays of phasor diagrams or complex impedance vectors could further demystify the mathematics. Because the simulation runs entirely in the browser, adventurous learners can modify the script to test these ideas without installing additional software.