Sub topic 12
The Ideal Integrator and Differentiator
This chapter assumes you know Ohm's law, KCL, the capacitor relation i = C dv/dt, and the virtual short and zero input current constraints for an op amp with negative feedback. It uses the inverting amplifier structure from the earlier chapter and replaces one resistor with a capacitor.
From the inverting amplifier to a dynamic circuit
The inverting amplifier has an input element and a feedback element. Both are resistors. If you swap one of them for a capacitor, the same analysis gives a gain that depends on time derivatives or integrals instead of a fixed ratio.
The method does not change:
- Set the inverting node voltage equal to the non-inverting node voltage (the virtual short).
- Set the op amp input currents to zero.
- Write KCL at the inverting node.
Here the non-inverting input is grounded, so the inverting node is a virtual ground at 0 V.
The ideal integrator
Place a resistor R in series with the input and a capacitor C in the feedback path.
Because the inverting node is at 0 V, the input current is
iR = vin / R
No current enters the op amp, so this same current flows through the capacitor, from the inverting node toward the output. The capacitor voltage is vC = 0 − vout = −v_out. Then
iC = C dvC/dt = −C dv_out/dt
KCL at the inverting node gives iR = iC, so
vin / R = −C dvout/dt
Integrating both sides from time 0 gives
vout(t) = −(1/RC) ∫ vin dt + v_out(0)
The output is the negative running integral of the input, scaled by 1/RC. The term v_out(0) is the initial capacitor voltage.
A constant input of V volts gives a ramp. The output changes at a rate of −V/(RC) volts per second.
The ideal differentiator
Swap the two parts: capacitor C in series with the input, resistor R in the feedback path.
The capacitor sits between v_in and the virtual ground, so
iC = C dvin/dt
This current flows through R toward the output. The voltage across R is 0 − v_out, so
iR = −vout / R
Setting iC = iR gives
vout(t) = −RC dvin/dt
The output is the negative derivative of the input, scaled by RC.
Worked example: integrating a step
Let R = 10 kΩ, C = 100 nF, and vin = 0.5 V from t = 0 with vout(0) = 0.
The time constant is RC = 10⁴ × 10⁻⁷ = 1 ms. The output is
v_out(t) = −(0.5 / 1 ms) t = −500 t volts
After 10 ms the output would be −5 V. With ±15 V supplies, the output reaches the rail at t = 30 ms and stays there. The ideal formula no longer holds past that point.
def integrator_output(v_in, r, c, t, v0=0.0, v_rail=15.0):
"""Output of an ideal integrator for a constant input, clipped at the rails."""
v = v0 - (v_in / (r * c)) * t
return max(-v_rail, min(v_rail, v))
for t_ms in (1, 10, 30, 50):
print(t_ms, integrator_output(0.5, 10e3, 100e-9, t_ms * 1e-3))
# 1 -0.5
# 10 -5.0
# 30 -15.0
# 50 -15.0Common errors
- Dropping the minus sign. Both circuits invert.
- Forgetting the initial condition v_out(0) in the integrator.
- Treating the differentiator as practical. Its gain rises with frequency (|gain| = ωRC), so it amplifies high-frequency noise and tends to be unstable. Real versions add a small series resistor with the input capacitor.
Exercise
An ideal differentiator has C = 10 nF and R = 100 kΩ. The input is a ramp vin = 2000 t volts, with t in seconds. What is vout?
Show answer
The derivative of the input is 2000 V/s and RC = 10⁻⁸ × 10⁵ = 1 ms. So v_out = −RC × 2000 = −0.001 × 2000 = −2 V, a constant.