seegongsik
SC · Control

Gain and Phase Margins

How far a stable system is from instability is read on the open-loop Bode plot as two margins. The phase margin is the angle left before the phase reaches −180° at the frequency where the gain is 0 dB, and the gain margin is how much the gain has left before reaching 0 dB at the frequency where the phase is −180°. In this lesson you move the gain K and follow how the two margins shrink to 0 as the system becomes unstable.

Measure the distance to instability with two margins

This is the Bode plot of the same open loop as in the F1 and F2 units, L(s) = K/(s(s + 1)(s + 2)). The top plot is gain (dB), the bottom is phase (degrees), and the horizontal axis is log frequency. In the top plot, the gold dot where the gold curve crosses the dashed 0 dB line is the gain crossover frequency, and the angle the phase curve below still has before the dashed −180° line at that frequency, the vertical bar in the bottom plot, is the phase margin. Where the phase below crosses −180° is the phase crossover frequency, fixed at ω = √2 for this plant, and the amount the gain curve above still has before 0 dB at that frequency, the vertical bar in the top plot, is the gain margin. Each bar is green when its margin is positive and red when it is negative. At the starting K = 8 both bars are red (phase margin about −7.5°, gain margin about −2.5 dB), and lowering K below 6 turns both green.

gain (dB), log ω axis
phase (deg), log ω axis
gain K8.0
Margins and crossover frequencies
K = 8.0 · PM = -8° · GM = -2.5 dB
gain xover ω = 1.63 · phase xover ω = 1.41
The gain is too large, so the gain crossover frequency has gone past the phase crossover frequency √2. Both the phase margin and the gain margin are negative, meaning L(jω) has passed the −1 point, so the closed loop is unstable. On the Bode plot, the gain curve sits above 0 dB at the frequency where the phase is −180°, so K has to be lowered below 6.
No margin (near unstable)

The room left before instability

The threshold at which unity feedback becomes unstable is when the open loop L(jω) becomes −1, that is, the moment a magnitude of 1 (0 dB) and a phase of −180° happen together at the same frequency. Then 1 + L = 0, and the closed-loop poles sit on the imaginary axis. The stability margins measure, in two directions, how far the present state is from this −1 condition. The phase margin measures how much the phase still has before −180° at the frequency where the magnitude has just reached 1, and the gain margin measures how much the magnitude still has before 1 at the frequency where the phase has just reached −180°. If both are positive, the loop has not reached −1 and is stable; at 0 it is on the boundary, and if they are negative it has already passed −1 and is unstable (for systems like this plant whose open loop is stable).

Observephase margin = 180° + phase at the 0 dB freq
The phase margin is the angle left before −180° at the 0 dB frequency.
Choosegain margin is read at the ?
The gain margin is the amount left before 0 dB at the −180° frequency.
Fill instable ⟺ both margins ?
If both margins are positive, the system is stable.
On your ownmargins reach 0 at K = ?
For this plant both margins become 0 at K = 6.

Read them at the two crossover frequencies

On a Bode plot you read these two at different frequencies. The frequency where the gain curve crosses 0 dB is called the gain crossover frequency, and reading the phase curve there and taking its difference from −180° gives phase margin = 180° + ∠L. Conversely, the frequency where the phase curve crosses −180° is the phase crossover frequency, which for this plant is fixed at ω = √2, from atan ω + atan(ω/2) = 90°. Reading the gain curve at that frequency gives gain margin = −20 log|L| dB, and since in this example the magnitude at the phase crossover is |L| = K/6, the gain margin is 20 log(6/K) dB. As K grows, the whole gain curve moves up, the gain crossover frequency shifts to the right, and since the phase has dropped further there, the phase margin shrinks too.

What the margins tell you

Stability margins tell you more than stable or unstable; they show how far a real system can be trusted. The first point is robustness. Models are always a little inaccurate, component values drift, and sensors have time delays. The phase margin is the amount of extra phase lag the closed loop can tolerate before it becomes unstable, and the gain margin is the factor of extra gain it can tolerate, so thin margins mean that small errors bring it down. The second point is the shape of the response. In a second-order approximation the phase margin is nearly proportional to the damping ratio, so a phase margin of about 45° ~ 60° corresponds to a good transient response with a damping ratio of 0.45 ~ 0.6; in fact, at K ≈ 1.04, chosen for ζ = 0.5 in the F2 unit, the phase margin is about 52° and the gain margin about 15 dB. So tuning the gain on a Bode plot for a target phase margin is the frequency-domain version of tuning the damping ratio in the D5 and F2 units.

Back to the first screen

On the first screen, you read the distance left before instability as two margins on the Bode plot of the same open loop as in the F1 and F2 units. The angle the phase had left before −180° at the frequency where the gain curve crosses 0 dB was the phase margin, and the amount the gain had left before 0 dB at the frequency where the phase crosses −180° (ω = √2) was the gain margin. Raising K moved the gain curve up and shrank both margins together, until both reached 0 at K = 6 and the system became unstable. This K = 6 is exactly the same boundary as the Routh test of the F1 unit and the imaginary-axis crossing of the root locus in the F2 unit. The same limit of the same system was seen by the Routh test through the coefficients, by the root locus through the path of the poles, and by the Bode plot through the margins of the frequency response.

Stability margins start from the fact that the closed loop becomes unstable when the open loop L(jω) reaches −1 (0 dB together with −180°), and measure on the Bode plot how far the loop is from that −1 now. Phase margin = 180° + ∠L (at the gain crossover, the frequency where |L| = 0 dB) and gain margin = −20 log|L| dB (at the phase crossover, the frequency where ∠L = −180°); if both are positive the system is stable, at 0 it is on the boundary, and if they are negative it is unstable. The phase margin is the extra delay the loop can tolerate and the gain margin the room for extra gain, so together they express robustness, and a phase margin of about 45° ~ 60° corresponds to a good transient response with a damping ratio of 0.45 ~ 0.6 (the frequency-domain version of the designs in the D5 and F2 units). The limit in this example, K = 6, is the same boundary as the Routh test of the F1 unit and the root locus of the F2 unit.
On to the next unit

The stability margins measured, on the Bode plot, the distance to the −1 condition in two directions. But −1 is a single point in the complex plane, so you could also plot L(jω) itself in the complex plane and look directly at its relation to that point. The next unit, The Nyquist Plot, draws the curve L(jω) traces as the frequency ω sweeps from 0 to infinity. The Nyquist criterion, which counts how many times that curve encircles the −1 point, settles closed-loop stability without exception, including cases where the open loop is already unstable. The phase and gain margins reappear there as how closely the curve passes by −1.