Lead and Lag Compensation
Raise the phase margin with lead compensation
This is the Bode plot of the open loop L(s) = 2·C(s)/(s(s + 1)(s + 2)), the same plant as in the F1 ~ F4 units with a gain of 2. The top is gain (dB), the bottom is phase (degrees), the gray dashed curves are before compensation (C = 1), and the gold solid curves are after adding the lead compensator C(s) = (1 + αTs)/(1 + Ts). Before compensation the phase margin is about 33°, short of the 45° target. Raising α widens the gap between zero and pole and raises a bump in the phase, whose maximum height is φ_max = asin((α − 1)/(α + 1)). Move the center frequency ω_m to set that bump near the gold dot, the crossover frequency where the gain passes 0 dB, and the phase lifts right there, enlarging the phase margin. For example, α = 4 with ω_m = 1.5 gives a phase margin of about 53°, and with the two knobs you can find settings between 45° ~ 60°.
One pole, one zero, a reshaped phase
A lead compensator has the form C(s) = (1 + αTs)/(1 + Ts) with α > 1, placing its zero at s = −1/(αT) and its pole at s = −1/T. Because the zero is closer to the origin than the pole, it acts first, at lower frequencies, so between the two corner frequencies the phase lifts positive. On the Bode plot, the phase tries to climb toward +90° at the zero until the pole pulls it back down, so the phase peaks at ω_m = 1/(T√α), the geometric mean of the two corners. That maximum depends only on the spacing ratio α, φ_max = asin((α − 1)/(α + 1)): about 37° for α = 4 and about 55° for α = 10. The larger α, the taller the bump, but the compensator's gain at that ω_m also rises by √α, so lead compensation is a trade that borrows phase in exchange for high-frequency gain.
Lag is the mirror image
A lag compensator has the same form but with α < 1, so its pole is closer to the origin than its zero. This time the phase dips slightly negative, and in exchange the gain drops by a factor of α going from low to high frequencies. Put the other way, relative to high frequencies it raises the low-frequency gain by 1/α, so you can raise the loop gain by 1/α while leaving the gain near the crossover frequency unchanged, and the larger DC gain reduces the steady-state error seen in the F5 unit. The cost of the phase dip is avoided by placing both corners far below the crossover frequency, because by the time the crossover frequency is reached the dip has nearly returned to 0 and barely touches the phase margin. If lead adds phase and speed like the derivative term, lag adds low-frequency gain and reduces error like the integral term, and using both together is lead-lag compensation.
Compensators built from circuits, and their limits
The appeal of a compensator is that it needs only one pole and one zero, so it turns directly into a circuit with an op amp and a few resistors and capacitors. A lead compensator resembles a differentiator, but thanks to its pole the high-frequency gain stops rising at α, which eases the problem of a pure derivative amplifying noise without limit. In fact, a practical PID and lead-lag compensation are close relatives. The integral term is a pole placed at the origin (the extreme case of lag), and a derivative term with a filter attached is a lead compensator, so the two do the same job in different languages. Choosing three gains in the time domain is PID tuning, and placing poles and zeros to shape the Bode plot in the frequency domain is compensator design. The limits are clear as well: lead raises high-frequency gain and is vulnerable to noise and saturation, and lag adds a slow pole that lengthens the settling time. So the knack of design is to borrow phase with lead and fill in accuracy with lag, using each only as much as truly needed.
Back to the first screen
On the first screen, you added a lead compensator to an open loop that had a phase margin of only about 33°. Raising α built a bump in the phase, and moving the center frequency ω_m near the crossover frequency where the gain passes 0 dB lifted the phase right there, far from −180°, raising the phase margin to a good value. With just one pole and one zero, the compensator lifted the phase of the Bode plot exactly where you wanted. If lead borrowed phase to add speed and stability, lag adds low-frequency gain to fill in accuracy. The phase margin you could only read in the F3 unit, you have now created yourself by designing a compensator.
We said a lag compensator raises the low-frequency gain to reduce steady-state error, but what exactly determines that error? The next unit, Steady-State Error, covers how the number of poles the open loop has at the origin, the system type (type 0, type 1, type 2), determines the final error for step, ramp, and parabolic inputs. The position error constant Kp, the velocity error constant Kv, and the acceleration error constant Ka each set that error, and a single pole at the origin drives the error for one kind of input all the way to 0. What the lag compensator did by raising the DC gain and what the integral term did by adding a pole at the origin are summed up there in a single table.