Gain Margin Calculator Formula

Understand the math behind the gain margin calculator. Each variable explained with a worked example.

Formulas Used

Gain Margin (absolute)

gm_abs = 1 / gain_at_180

Gain Margin

gm_db = -20 * log10(gain_at_180)

Maximum Gain Increase Before Instability

max_gain_increase = (1 / gain_at_180 - 1) * 100

Variables

VariableDescriptionDefault
gain_at_180Open-Loop Gain at Phase = -180° (|G|)0.5

How It Works

Gain Margin

Gain margin measures how much the open-loop gain can increase before the system becomes unstable. It is evaluated at the phase crossover frequency (where the open-loop phase equals -180°).

Formula

GM = 1 / |G(j*omega_pc)| = -20*log10(|G(j*omega_pc)|) dB

where omega_pc is the phase crossover frequency. A positive gain margin (in dB) indicates stability. The larger the gain margin, the more robust the system is to gain variations.

Worked Example

The open-loop gain magnitude at -180° phase is 0.5.

gain_at_180 = 0.5
  1. 01GM = 1 / 0.5 = 2.0 (absolute)
  2. 02GM = -20 × log10(0.5) = -20 × (-0.301) = 6.02 dB
  3. 03The gain can be increased by 100% before instability

Ready to run the numbers?

Open Gain Margin Calculator