what's this demo?
The damped second-order plant G(s) = 1 / (s² + 0.4 s + 1) is the workhorse of every intro controls course. It lags. It rings. It's just hard enough to make a controller look smart and just simple enough to debug in your head.
Below is the same plant wearing two faces. On top: a needle gauge that sweeps from 0 toward the red target line at in real time — the way an oven temperature dial or a motor-RPM tach would actually look on a real machine. Below it: the same response, but plotted vs. time so you can see rise, overshoot, and settle in retrospect. Hit ▶ play to watch a 20-second run.
PID step response
Plant G(s) = 1 / (s² + 0.4 s + 1). Controller u = Kp e + Ki ∫e dt + Kd ė. Setpoint steps from 0 → 1 at t = 0.
what to try
- Hit ▶ play with defaults. The needle leaves 0, ramps up, overshoots past the target, then settles. The trace below records that whole story; the dot on it tracks the needle.
- Pure proportional (Ki = Kd = 0): bump Kp. Faster needle, but it parks below the target — the steady-state offset never goes away.
- Add integral: the needle eventually pulls up to the target, but overshoot grows and settling stretches out.
- Add derivative: overshoot calms down — D acts on the rate of change, so it brakes before the needle hits the wall.
- Now turn on noise and replay. The D-term explodes because it amplifies the derivative of the noisy measurement — watch the needle judder. This is why we'll need observers (Lesson 10).
- Kick the plant. At t = 8 s the needle suddenly drops; only the I-term reliably brings it back to the target.
- Ziegler–Nichols ballpark: Kp ≈ 3.0, Ki ≈ 1.5, Kd ≈ 0.7.
show the math
The plant is canonical damped second-order with natural frequency and damping ratio :
The controller closes the loop on the error :
We integrate by forward-Euler at for . Toggling noise adds Gaussian to the measurement before the error is computed — notice how the derivative term reacts to the noisy measurement, not the smooth true state.