ENع
←Gain from the locus
Lesson 28 · Root locus

Choosing the gain for a target damping ratio

15 min10 steps5 questionsIntermediate
About this lesson

A motor turns a camera arm, and an amplifier gain K is the only knob. Turn K up and watch the three closed-loop poles trace the root locus. Then draw the ray where the damping ratio is 0.5, find where it crosses the locus, and read the gain off the pole-to-point lengths: K = 1.037. A step response integrated from the closed loop checks the design, and K = 3 shows what more gain costs.

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 28 · Interactive
01 / 10

One loop, one knob

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.

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?
Loading figure…
or ← →
Read the lesson step by step
  1. One loop, one knob

    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.

    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?
  2. The poles depend on K

    The closed-loop poles are the roots of 1 + K·G(s) = 0, which here is s³ + 3s² + 2s + K = 0. Every K gives three poles. At K = 0 they sit on the plant's own poles: 0, −1 and −2.

    1 + K·G(s) = 0
    1 + K / (s(s + 1)(s + 2)) = 0
    s(s + 1)(s + 2) + K = 0
    s³ + 3s² + 2s + K = 0
    
    K = 0   poles  0, -1, -2   (the plant's own)
    K > 0   the poles move
    
    The sum of the three poles is always -3
    (minus the s² coefficient), whatever K is.
  3. Turn K up: the root locus

    Turn the dial from 0 to 6 and follow the poles. Two meet at −0.423 and leave the axis; the third heads left. Their paths are the root locus. At K = 6 the pair reaches ±1.41j: the edge of stability.

    K from 0 to 6:
      0 and -1 move towards each other
      meet at s = -0.423  (K = 0.385)
      then split into a complex pair
      -2 moves left
    
    K = 6  poles ±j√2 = ±1.41j and -3
           (the imaginary-axis crossing)
    K > 6  the pair is in the right half: unstable
    
    The breakaway point and the crossing are
    worked out in the lesson "Breakaway points
    and the imaginary-axis crossing".
  4. The target: a ray of ζ = 0.5

    We want the pair's damping ratio ζ = 0.5: about 16.3% overshoot for a pure two-pole system. Every pole with ζ = 0.5 lies on one ray from the origin, 60° up from the negative real axis, because cos 60° = 0.5.

    damping ratio  ζ = 0.5
    
    for a pole -σ ± jωd:  ζ = σ / |p| = cos θ
    θ = angle from the negative real axis
    
    ζ = 0.5   →   θ = cos⁻¹(0.5) = 60°
    
    pure second-order pair:
    %OS = 100·e^(-ζπ/√(1-ζ²)) = 16.3 %
    
    So the design point is wherever this ray
    crosses the locus.
  5. Where the ray meets the locus

    A point is on the locus when the angles from the plant's poles add up to 180°. Walking out along the ray, that happens at distance 0.667 from the origin: s* = −0.333 + 0.577j. This is our design point.

    # walk out along the ζ = 0.5 ray until the
    # angles from 0, -1, -2 add up to 180°
    import cmath, math
    ray = cmath.exp(1j * math.radians(120))
    def angles(r):
        s = r * ray
        return sum(math.degrees(cmath.phase(s + p)) for p in (0, 1, 2))
    lo, hi = 0.01, 1.4
    for _ in range(60):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if angles(mid) < 180 else (lo, mid)
    s = lo * ray
    print(round(lo, 3), round(s.real, 3), round(s.imag, 3))   # 0.667 -0.333 0.577
  6. Read K off the lengths

    On the locus, K = 1/|G(s*)|: multiply the distances from the plant's poles to s*. That is 0.667 × 0.882 × 1.764 = 1.037. In Python, K = −1/G(s) gives the same number in one line.

    # the magnitude criterion: |K·G(s*)| = 1
    G = lambda s: 1 / (s * (s + 1) * (s + 2))
    s = complex(-1/3, 3 ** -0.5)      # the design point
    lengths = [abs(s), abs(s + 1), abs(s + 2)]
    K = -1 / G(s)                     # from 1 + K·G = 0
    print([round(x, 3) for x in lengths], round(K.real, 3), abs(K.imag) < 1e-12)
    # [0.667, 0.882, 1.764] 1.037 True
  7. Turn the dial to 1.037

    Set K = 1.037 (exactly 28/27). The pair glides onto the ray at −0.333 ± 0.577j. The third pole stops at −2.33, because the three poles must still add up to −3.

    K = 28/27 = 1.037
    
    poles  -0.333 ± 0.577j   (ζ = 0.500, ωn = 0.667)
           -2.33
    
    check: (s² + (2/3)s + 4/9)(s + 7/3)
         = s³ + 3s² + 2s + 28/27   ✓
    
    sum of poles  -1/3 - 1/3 - 7/3 = -3  ✓
  8. Is the pair in charge?

    The pair's real part is −0.333; the third pole sits at −2.33, 7 times further left. Its term e^(−2.33t) dies 7 times faster, so the pair sets the shape. A common rule asks for at least 5 times.

    pair         -0.333 ± 0.577j   fades like e^(-0.333t)
    third pole   -2.333            fades like e^(-2.333t)
    
    ratio  2.333 / 0.333 = 7
    
    rule of thumb: the other poles at least
    about 5 times further left than the pair
    → the pair is dominant; the second-order
      formulas are a good first guess.
  9. Check the step response

    Now the real test: a unit step, integrated from the closed loop. The arm overshoots by 15.5% at 5.93 s and stays within 2% after 12.5 s. The predicted 16.3% was close: the third pole trims a little.

    # step response of K / (s³ + 3s² + 2s + K), RK4
    K, dt = 28 / 27, 0.001
    y, v, a, t, peak = 0.0, 0.0, 0.0, 0.0, (0.0, 0.0)
    f = lambda y, v, a: (v, a, K * (1 - y) - 2 * v - 3 * a)
    while t < 40:
        k1 = f(y, v, a)
        k2 = f(*[x + dt / 2 * d for x, d in zip((y, v, a), k1)])
        k3 = f(*[x + dt / 2 * d for x, d in zip((y, v, a), k2)])
        k4 = f(*[x + dt * d for x, d in zip((y, v, a), k3)])
        y, v, a = [x + dt / 6 * (p + 2 * q + 2 * r + s) for x, p, q, r, s in zip((y, v, a), k1, k2, k3, k4)]
        t += dt
        peak = max(peak, (y, t))
    print(round(100 * (peak[0] - 1), 1), round(peak[1], 2))   # 15.5 5.93
  10. More gain, more swing

    Why not more gain? At K = 3 the pair climbs past the ray to −0.164 ± 1.047j, ζ = 0.15. The arm overshoots 56.5% and needs 22.2 s to settle. On the root locus, picking K means picking this trade.

                K = 1.037       K = 3
    pair        -0.333 ± 0.577j   -0.164 ± 1.047j
    ζ           0.50             0.15
    third pole  -2.33            -2.67
    overshoot   15.5 %          56.5 %
    settling    12.5 s           22.2 s
    
    more K: faster start, more swing, less margin
    (K = 6 swings for ever).

Quiz Unlocks after the last step.