Bode Plot Gain and Phase Margin Calculator

Find the gain margin, phase margin, and crossover frequencies of a classic single-integrator, two-real-pole open-loop system, with magnitude and phase Bode plots.

📊 Bode Plot Gain and Phase Margin Calculator
Open-loop DC gain (K)10
0.1100
Pole time constant (T1)0.5 s
s
0.015
Pole time constant (T2)0.1 s
s
0.015
Stability
Gain crossover (ωgc)
Phase margin (PM)
Phase crossover (ωpc)
Gain margin (GM)
Step-by-step working

📊 What are Gain Margin and Phase Margin?

A Bode plot shows how a system's open-loop magnitude and phase change with frequency, and its gain margin and phase margin are the two classic numbers engineers read off that plot to judge how close a feedback system sits to instability. Phase margin is how much extra phase lag the loop could tolerate at the frequency where its gain is exactly 1 (0 dB) before the system becomes unstable. Gain margin is how much extra gain the loop could tolerate at the frequency where its phase is exactly -180 degrees before the same thing happens. Both numbers being comfortably positive is the standard, quick way to confirm a feedback loop is stable with reasonable safety margin.

Control engineers use gain and phase margin constantly when tuning feedback loops, from a motor speed controller to a power supply's voltage regulation loop to an aircraft's autopilot. A designer increasing a controller's gain to make the system respond faster checks the phase margin after every change, since gain and phase margin trade off directly against response speed: push the gain crossover frequency higher for a faster response, and the margins typically shrink. An engineer troubleshooting a loop that oscillates or overshoots excessively often finds the phase margin is too small, well under the commonly cited 30 to 60 degree comfort zone.

A common misconception is that a system with a positive gain margin and a positive phase margin is automatically "very stable" regardless of the actual margin size. In reality, a phase margin of just a few degrees is still technically stable but practically fragile, small changes in the plant (temperature drift, aging components, an unmodeled delay) can easily push such a system into instability. The margin size, not just its sign, is what tells you how much real-world headroom a design has.

This calculator takes the DC gain K and two pole time constants T1, T2 of a classic single-integrator, two-real-pole open-loop transfer function, numerically finds the gain and phase crossover frequencies, computes both margins, gives a clear stability verdict, and plots the full magnitude and phase Bode plots with each crossover frequency marked.

📐 Formula

G(s)  =  K / (s(1 + sT1)(1 + sT2))
|G(jω)| = K / (ω √(1+(ωT1)²) √(1+(ωT2)²))
∠G(jω) = −90° − arctan(ωT1) − arctan(ωT2)
ωgc = gain crossover frequency, where |G(jω)| = 1 (0 dB); found by numeric root search since no closed form exists for this order
PM = 180° + ∠G(jωgc), phase margin
ωpc = phase crossover frequency, where ∠G(jω) = −180°; also found by numeric root search
GM = −20log₁₀|G(jωpc)|, gain margin in dB
Example: K = 10, T1 = 0.5 s, T2 = 0.1 s → ωgc ≈ 4.078 rad/s, PM ≈ 3.94° (marginally stable, low safety margin).

📖 How to Use This Calculator

Steps

1
Enter the DC gain. Type the open-loop DC gain K.
2
Enter the two pole time constants. Type the time constants T1 and T2 for the two real poles, in seconds.
3
Read the margins and Bode plots. See the gain crossover frequency, phase margin, phase crossover frequency, gain margin, stability verdict, and the magnitude and phase Bode plots.

💡 Example Calculations

Example 1 — Marginally Stable Default Case

K = 10, T1 = 0.5 s, T2 = 0.1 s

1
Numeric search for |G(jω)| = 1 finds ωgc4.078 rad/s
2
Phase at ωgc: ∠G(j4.078) ≈ −176.06°, so PM = 180 − 176.06 = 3.94°
3
Numeric search for phase = −180° finds ωpc ≈ 4.472 rad/s, giving GM ≈ 1.58 dB
PM = 3.94°, GM = 1.58 dB, verdict = Stable (both margins positive but small)
Try this example →

Example 2 — Unstable, High Gain

K = 50, T1 = 0.5 s, T2 = 0.1 s (same poles, higher gain)

1
Raising K shifts the magnitude curve up, pushing ωgc to a higher 8.595 rad/s
2
Phase at that higher frequency is already well past −180°, giving PM = −27.58°
3
ωpc is unchanged at 4.472 rad/s (phase depends only on T1, T2, not K), but the magnitude there is now above 0 dB, giving GM = −12.40 dB
PM = −27.58°, GM = −12.40 dB, verdict = Unstable
Try this example →

Example 3 — Comfortably Stable, Low Gain

K = 2, T1 = 1 s, T2 = 0.2 s

1
Lower gain and slower poles push ωgc down to 1.227 rad/s
2
Phase at that lower frequency is far less negative, giving PM = 25.39°
3
ωpc ≈ 2.236 rad/s, with the magnitude there well below 0 dB, giving GM = 9.54 dB
PM = 25.39°, GM = 9.54 dB, verdict = Stable (comfortable margins)
Try this example →

❓ Frequently Asked Questions

What is the difference between gain margin and phase margin?+
Phase margin is how much additional phase lag it would take to push the system to instability, measured at the gain crossover frequency where the loop gain is exactly 1 (0 dB). Gain margin is how much additional gain it would take to push the system to instability, measured at the phase crossover frequency where the phase is exactly -180 degrees. Both must be positive for a stable closed loop.
How do you find the gain crossover frequency?+
The gain crossover frequency wgc is the frequency where the open-loop magnitude |G(jw)| equals 1 (0 dB). For a system with no closed-form solution, this is found by numeric root search, since |G(jw)| decreases monotonically for a Type-1 system with real poles, a simple bisection search converges quickly.
How do you find the phase crossover frequency?+
The phase crossover frequency wpc is the frequency where the open-loop phase equals -180 degrees. Like the gain crossover, this is found by numeric root search rather than an algebraic formula for anything beyond a simple two-pole system.
What is a good phase margin for a stable control system?+
A phase margin between 30 and 60 degrees is the commonly cited target range for practical control loops, giving a reasonable balance between fast response and acceptable overshoot. Margins near or below 0 degrees mean the system is marginally stable or unstable.
What happens if the phase margin is negative?+
A negative phase margin means the open-loop phase has already dropped below -180 degrees by the time the gain crosses 0 dB, which means the closed-loop system (with unity negative feedback) is unstable, its response grows without bound rather than settling.
Why does the phase start near -90 degrees instead of 0 degrees?+
The single integrator term (1/s) in the transfer function contributes a constant -90 degree phase shift at every frequency. At very low frequencies, before either real pole's phase lag becomes significant, the total phase sits close to this -90 degree integrator contribution.
What does the DC gain K represent in this transfer function?+
K is the overall gain multiplier of the open-loop transfer function G(s) = K / (s(1+sT1)(1+sT2)). It shifts the entire magnitude curve up or down on the Bode plot (in dB, by 20*log10(K)) without changing the phase curve, since a real positive constant contributes zero phase shift.
Can I use this calculator for a system without an integrator?+
No, not directly. This calculator is scoped to the specific structure K/(s(1+sT1)(1+sT2)), which always includes exactly one integrator and two real poles. A system without the integrator term would need a different transfer function structure and a separate tool.
What is the relationship between a Bode plot and a Nyquist plot?+
A Bode plot shows magnitude and phase separately as two curves versus frequency, which is what this calculator plots. A Nyquist plot instead traces the same frequency response as a single curve in the complex plane, and its encirclements of the point -1+0j give an equivalent, sometimes more general, stability criterion covering cases a simple gain/phase margin reading can miss.
Why does increasing K reduce the phase margin?+
Raising K shifts the magnitude curve upward on the Bode plot without moving the phase curve, which pushes the gain crossover frequency to a higher value. Since phase keeps decreasing (becoming more negative) as frequency increases for this system, a higher gain crossover frequency means a more negative phase there, and therefore a smaller phase margin.

What is the difference between gain margin and phase margin?

Phase margin is how much additional phase lag it would take to push the system to instability, measured at the gain crossover frequency where the loop gain is exactly 1 (0 dB). Gain margin is how much additional gain it would take to push the system to instability, measured at the phase crossover frequency where the phase is exactly -180 degrees. Both must be positive for a stable closed loop.

How do you find the gain crossover frequency?

The gain crossover frequency wgc is the frequency where the open-loop magnitude |G(jw)| equals 1 (0 dB). For a system with no closed-form solution, this is found by numeric root search, since |G(jw)| decreases monotonically for a Type-1 system with real poles, a simple bisection search converges quickly.

How do you find the phase crossover frequency?

The phase crossover frequency wpc is the frequency where the open-loop phase equals -180 degrees. Like the gain crossover, this is found by numeric root search rather than an algebraic formula for anything beyond a simple two-pole system.

What is a good phase margin for a stable control system?

A phase margin between 30 and 60 degrees is the commonly cited target range for practical control loops, giving a reasonable balance between fast response and acceptable overshoot. Margins near or below 0 degrees mean the system is marginally stable or unstable.

What happens if the phase margin is negative?

A negative phase margin means the open-loop phase has already dropped below -180 degrees by the time the gain crosses 0 dB, which means the closed-loop system (with unity negative feedback) is unstable, its response grows without bound rather than settling.

Why does the phase start near -90 degrees instead of 0 degrees?

The single integrator term (1/s) in the transfer function contributes a constant -90 degree phase shift at every frequency. At very low frequencies, before either real pole's phase lag becomes significant, the total phase sits close to this -90 degree integrator contribution.

What does the DC gain K represent in this transfer function?

K is the overall gain multiplier of the open-loop transfer function G(s) = K / (s(1+sT1)(1+sT2)). It shifts the entire magnitude curve up or down on the Bode plot (in dB, by 20*log10(K)) without changing the phase curve, since a real positive constant contributes zero phase shift.

Can I use this calculator for a system without an integrator?

No, not directly. This calculator is scoped to the specific structure K/(s(1+sT1)(1+sT2)), which always includes exactly one integrator and two real poles. A system without the integrator term would need a different transfer function structure and a separate tool.

What is the relationship between a Bode plot and a Nyquist plot?

A Bode plot shows magnitude and phase separately as two curves versus frequency, which is what this calculator plots. A Nyquist plot instead traces the same frequency response as a single curve in the complex plane, and its encirclements of the point -1+0j give an equivalent, sometimes more general, stability criterion covering cases a simple gain/phase margin reading can miss.

Why does increasing K reduce the phase margin?

Raising K shifts the magnitude curve upward on the Bode plot without moving the phase curve, which pushes the gain crossover frequency to a higher value. Since phase keeps decreasing (becoming more negative) as frequency increases for this system, a higher gain crossover frequency means a more negative phase there, and therefore a smaller phase margin.