control//frequency response//stability margins
Stability margins are the measures of how far a stable feedback loop is from oscillating, stated as the extra gain, extra phase lag or extra delay it could absorb before it loses stability, and they are the form in which controller specifications are written in aeronautics, automotive and process control: a loop is accepted when it stays stable as the plant shifts, which being stable today does not show. A drone's battery sags and the same command gives a quarter less thrust; a valve wears; an unmodelled filter adds a few milliseconds. Each of those eats a margin, and the margin says how much can be eaten.
Stability margins are the measures of how far a stable feedback loop is from oscillating, stated as the extra gain, extra phase lag or extra delay it could absorb before it loses stability, and they are the form in which controller specifications are written in aeronautics, automotive and process control: a loop is accepted when it stays stable as the plant shifts, which being stable today does not show. A drone's battery sags and the same command gives a quarter less thrust; a valve wears; an unmodelled filter adds a few milliseconds. Each of those eats a margin, and the margin says how much can be eaten.
All of them are read from the loop gain L(jω)L(j\omega)L(jω), the trip once round controller and plant, at two special frequencies. The crossover frequency ωc\omega_cωc is where the loop gain equals one, roughly the loop's bandwidth. The phase crossover is where the loop's phase lag reaches 180 degrees, the frequency at which a correction arrives in step with the error.
The gain margin is the factor by which the loop gain could grow, at the phase crossover, before a trip round the loop amplifies instead of shrinking. The usual target is 2 or more, 6 dB. It protects against everything that scales the loop: a heavier vehicle, a sagging battery, a valve whose gain changes along its travel, a plant gain misjudged in a step test.
The phase margin is the lag the loop could still take at crossover, usually 45 to 60 degrees. It protects against lags nobody modelled, and it is the one that filters, sampling and computation eat, because each of them adds phase without touching the gain.
The delay margin is the phase margin turned into seconds, τmax=φm/ωc\tau_{max}=\varphi_m/\omega_cτmax=φm/ωc. It is the margin a timing budget is checked against, and it shrinks as the loop gets faster.
Margins assume one thing changing at a time. A loop with a fine gain margin and a fine phase margin can still be fragile to both degrading together; the peak of the sensitivity function covers that case in one number, and robust design (robust control) takes the uncertainty in as a whole family of plants.
They can be measured as well as computed. The margins are drawn on a Bode plot (they are distances to the critical point of the Nyquist stability criterion) or returned by a call (control.margin in python-control, margin in MATLAB); on hardware, a sine sweep measures the loop gain, and a relay autotuning test finds the phase crossover directly.