Together these give an indication of the relative stability (robust stability) of the system.

These are generalized for the Nyquist Plot (Polar Locus), not for Bode Plots, for more on that: More Here

Phase Margin

is equal to the extra phase lag that could be added to get closed loop instability. It is calculated by determining the phase, , when and adding this phase to .

Gain Margin

is defined as that factor by which you would have to increase the gain to get instability. It is calculated by determining the magnitude, , when , and the gain margin is defined as:

Examples:

General: