unit stepr − yK = 01 / s(s+1)(s+2)angle y1G = lambda s: 1/(s*(s+1)*(s+2))2s = complex(-1/3, 3**-0.5)3K = -1 / G(s) # 1.037K = 1.037
−3−2−101−2−1012σ, real partjω, imaginary partS-PLANE: ROOT LOCUSζ = 0.560°|s*|0.667|s*+1|0.882|s*+2|1.764K1.037s*0612182400.511.5time (s)arm angle ySTEP RESPONSE y(t)K = 1.037dial's K
Lit wire with moving dashes: a signal is flowing along itBlocks: command, compare, gain dial K, plant G(s), arm angle; the code card finds KPlots: the root locus on the s-plane (dots = closed-loop poles) and the step response at the dial's KThe pill travelling into the plant is the new gain KA unity-feedback servo: the gain dial K is the only thing we change. The s-plane shows the root locus, every place the three closed-loop poles can sit as K grows, and the ray of damping ratio 0.5. Where the ray crosses the locus is the design point; the product of the distances from the plant's poles to it is the gain, K = 1.037. The step response is integrated from the closed loop at the dial's K. The 16.3% overshoot from ζ = 0.5 is exact only for two poles and no zeros. Here the third pole at −7/3 lowers it to 15.5%. That is why a design read off the root locus is always checked with a simulated step response.

Poles that move with K

  1. A motor turns a camera arm to the angle we ask for. The plant is G(s) = 1/(s(s+1)(s+2)). An amplifier multiplies the error by a gain K, and feedback brings the arm's angle back to compare. K is our only knob.

Find the gain

Check it

The working

# step 1/10 · loop
# about: Command: unit step, Compare (error), Gain dial K, Plant G(s), Arm angle y

plant         G(s) = 1 / (s(s + 1)(s + 2))
controller    gain K (an amplifier)
feedback      unity: error = command - angle

closed loop   T(s) = K·G / (1 + K·G)
                   = K / (s³ + 3s² + 2s + K)

The question: which K gives a good response?

The plant 1/(s(s+1)(s+2)) is a standard textbook servo model with round numbers, not a measured motor. The locus is the exact roots of s³ + 3s² + 2s + K for many values of K; the step responses are integrated from the closed loop (RK4, 0.01 s steps) and measured to a 2% band. The Python uses only the standard library. With python-control installed, ct.root_locus_plot(ct.tf([1], [1, 3, 2, 0]), grid=True) draws this locus with lines of constant damping.