ENع
←Lead-lag design
Lesson 43 · PID control and compensators

Designing a lead-lag compensator

18 min10 steps5 questionsAdvanced
About this lesson

One plant, two specs that fight: a ramp error of 0.1 (Kv = 10) and a phase margin of at least 45°. Gain alone gives the accuracy but makes the loop unstable, and lead alone falls short too. Design the lead and the lag by hand on the Bode plot, watch their decibels and degrees add, then close the loop and check the step and the ramp.

You'll learn to

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

Fig 43 · Interactive
01 / 10

One plant, two specs

The plant is G(s) = 1/(s(s + 1)(s + 2)). We want two things at once: follow a ramp with an error of only 0.1, so Kv = 10, and a phase margin of at least 45°, so the step response stays calm.

plant   G(s) = 1 / ( s (s + 1)(s + 2) )

spec 1  Kv = lim s·L(s) = 10   (s → 0)
        ramp error = 1/Kv = 0.1
spec 2  phase margin ≥ 45°

Kv is set by the LOW end of the Bode plot,
the phase margin by the MIDDLE (crossover).
Loading figure…
or ← →
Read the lesson step by step
  1. One plant, two specs

    The plant is G(s) = 1/(s(s + 1)(s + 2)). We want two things at once: follow a ramp with an error of only 0.1, so Kv = 10, and a phase margin of at least 45°, so the step response stays calm.

    plant   G(s) = 1 / ( s (s + 1)(s + 2) )
    
    spec 1  Kv = lim s·L(s) = 10   (s → 0)
            ramp error = 1/Kv = 0.1
    spec 2  phase margin ≥ 45°
    
    Kv is set by the LOW end of the Bode plot,
    the phase margin by the MIDDLE (crossover).
  2. Gain buys accuracy

    Kv = lim s·K·G(s) = K/2, so K = 20 gives Kv = 10. On the Bode plot the whole gain curve lifts, and its low-frequency line K/(2ω) meets 0 dB at ω = 10. The phase curve does not move.

    s·K·G(s) = K / ((s + 1)(s + 2))  →  K/2
    Kv = 20/2 = 10   ramp error = 0.1  ✓
    
    low end   |L| ≈ Kv/ω   (−20 dB/decade)
              meets 0 dB at ω = Kv = 10
    
    A pure gain lifts |L| and leaves ∠L alone.
  3. …and loses the margin

    But the curve now crosses 0 dB at 2.43 rad/s, where the phase is already −208.1°. That is 28.1° past −180°: a phase margin of −28.1°. The loop would feed itself.

    K·G at the crossover ωc = 2.43 rad/s
    |L| = 1 (0 dB)
    ∠L  = −208.1°
    phase margin = 180° + ∠L = −28.1°  ✗
    
    Routh test (reads stability straight from the
    coefficients of s³ + 3s² + 2s + K):
    stable only for K < 6. We need K = 20.
  4. Close it: it runs away

    Close the loop and send a unit step. The output shoots to 2.57, falls to −1.82, then climbs to 6.06: every swing is wider. Gain alone cannot meet both specs. We must reshape the middle of the curve and keep the low end.

    closed loop  T(s) = 20 / (s³ + 3s² + 2s + 20)
    
    turning points of y(t)
    t = 1.6 s   y = 2.57
    t = 3.0 s   y = −1.82
    t = 4.4 s   y = 6.06
    
    Unstable: a growing oscillation.
    Routh test (stability from the coefficients):
    stable only for K < 6.
  5. Lead: phase where needed

    New crossover: 1 rad/s, where ∠G = −161.6°, a margin of only 18.4°. Want 50° after the lag, plus about 5° the lag will cost: 55 − 18.4 ≈ 37°. A lead (1 + s/0.5)/(1 + s/2) peaks at 1 rad/s with 36.9°, +6.0 dB.

    lead  (1 + s/0.5) / (1 + s/2)   zero below pole
    
    ratio   α = 0.5/2 = 0.25
    centre  ω = √(0.5·2) = 1 rad/s
    max     sin φ = (1 − α)/(1 + α) = 0.6
            φ = 36.9°
    gain    ×√(1/α) = ×2 (+6.0 dB) there,
            +12.0 dB far above
  6. Lead alone falls short

    Add the lead to K·G: the decibels add, and so do the degrees. The lead's extra gain drags crossover right, to 3.96 rad/s, where the plant has lost even more phase. Margin: −29.5°. Still unstable.

    |L| (dB) = |K·G| (dB) + |lead| (dB)
    ∠L       = ∠K·G      + ∠lead
    
    new crossover   3.96 rad/s
    phase margin    −29.5°  ✗
    
    The lead's phase arrived at 1 rad/s,
    but crossover ran away from it.
  7. Lag: pull the gain down

    At 1 rad/s, K·G plus lead is 16.0 + 6.0 = 22.0 dB too high. A lag removes exactly that above its corners: zero at 0.1, a decade below, pole at 0.1/12.65 = 0.0079. Its cost at 1 rad/s: −5.3°.

    lag  (1 + s/0.1) / (1 + s/0.0079)   pole below zero
    
    needed cut at 1 rad/s   22.0 dB (×12.65)
    zero   ωc/10 = 0.1 rad/s
    pole   0.1/12.65 = 0.0079 rad/s
    high   −22.0 dB
    low    0 dB   (Kv untouched)
    phase at 1 rad/s  −5.3°
  8. Add them: the design

    With both in the loop, |L| crosses 0 dB at 1.00 rad/s, where ∠L = −130.2°. Phase margin 49.8°, comfortably over 45°, and gain margin 11.4 dB. The low end is K·G's, so Kv is still 10.

    import math
    deg = math.degrees
    def mag(w):   # |L(jw)|, L = 20 lead lag G
        h = lambda c: math.hypot(1, w / c)
        return 20*h(0.5)*h(0.1)/(h(2)*h(0.007906)*w*h(1)*math.hypot(2, w))
    def ph(w):    # angle of L(jw), degrees
        a = lambda c: deg(math.atan(w / c))
        return -90 - a(1) - a(2) + a(0.5) - a(2) + a(0.1) - a(0.007906)
    lo, hi = 0.01, 100.0
    for _ in range(60):
        mid = math.sqrt(lo * hi)
        lo, hi = (mid, hi) if mag(mid) > 1 else (lo, mid)
    print(f"{lo:.2f} {180 + ph(lo):.1f}")   # 1.00 49.8
  9. Close the loop: a step

    Close the loop and send the step. It is stable now: a peak of 1.21 at 2.78 s (21% overshoot). Then a slow creep, 1.05 at 10 s, inside 2% only by 19.6 s: the lag's slow pole and zero leave a long tail.

    peak         1.21 at 2.78 s
    overshoot    21 %
    settles (2%) 19.6 s
    
    The lag's pole-zero pair near the origin
    puts a closed-loop pole near s = −0.1:
    a small, slow tail. Moving the lag zero
    higher shortens it but costs phase.
  10. Accuracy kept

    Now send a ramp, r = t. After a minute the output trails it by 0.10, just as Kv = 10 promised: the lead and the lag both have a gain of 1 at ω = 0, so the low end of |L| never moved.

    ramp test, r(t) = t
    error at 60 s   0.10
    1/Kv            0.10
    
    Gc(s) = 20 · (1 + s/0.5)/(1 + s/2)
               · (1 + s/0.1)/(1 + s/0.0079)
    Gc(0) = 20: lead and lag are 1 at DC.
    
    lead  → phase at crossover (speed, calm)
    lag   → gain at the low end (accuracy)

Quiz Unlocks after the last step.