Toolvito

Works on this device

Phase Margin Calculator

Type the open-loop transfer function G(s) of a feedback loop, or points from its Bode plot. The calculator finds where |G| = 1 (0 dB) and how far the phase is from −180° there.

Enter your values

Type the open-loop transfer function G(s) = K × N(s) ÷ D(s), with a time delay if there is one.

Your values

A polynomial in s. You can multiply brackets, such as 2(s + 3) or (0.5s + 1)^2.

A polynomial in s, such as s(s + 1)(s + 5) or s^3 + 6s^2 + 5s.

A number that multiplies N(s) ÷ D(s). Keep 1 when the gain is already in N(s).

A dead time e^(−sT) in the loop. Keep 0 when there is none.

More options

Leave both frequencies empty for a range chosen from the poles, zeros and crossovers.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Choose Phase margin of a transfer function G(s).
  2. Type the numerator N(s) and the denominator D(s) as polynomials in s, such as 10 and s(s + 1)(s + 5), or choose to type lists of coefficients, highest power first.
  3. Type the gain K and, if the loop has a dead time, the time delay T.
  4. Choose Calculate. The result gives the phase margin, the gain crossover frequency, the delay margin, the gain margin, every crossover in a table, the poles and zeros, and the Bode charts.
  5. With measured points, choose Phase margin from frequency response points. With a value read from a plot, choose Phase margin from the phase at the gain crossover.

The formulas

  • The loop transfer function is G(s) = K × N(s) ÷ D(s) × e^(−sT). The frequency response is G(jω), with ω in rad/s.
  • Gain crossover frequency ω_gc: the frequency where |G(jω)| = 1, that is 0 dB.
  • Phase margin: PM = 180° + the phase of G(jω_gc). It is brought into the range above −180° up to 180°, so a phase of −200° gives −20°.
  • Delay margin: PM in radians ÷ ω_gc. A dead time T turns the phase by −ωT radians, so this much extra delay uses up the phase margin.
  • Gain margin (also shown): GM = −20 log10 |G(jω_pc)| in dB where the phase is −180°. The Gain Margin Calculator explains it.
  • Standard second-order loop ω_n² ÷ (s(s + 2ζω_n)): ω_gc ÷ ω_n = √(√(1 + 4ζ⁴) − 2ζ²) and PM = arctan(2ζ ÷ (ω_gc ÷ ω_n)); back again, ζ = sin PM ÷ (2√(cos PM)).

How the crossovers are found

Write N(jω) = A(ω²) + jω B(ω²) and D(jω) = C(ω²) + jω E(ω²). With x = ω², the gain crossovers are the roots of the exact polynomial P(x) = K²(A² + xB²) − (C² + xE²). The calculator isolates its real roots with a Sturm sequence in exact fractions and narrows each root by bisection until the interval is narrower than 2^−52 of x. The phase there comes from G(jω) itself.

A time delay e^(−sT) is used exactly: it does not change |G|, so the gain crossovers stay the same, and it turns the phase by −ωT radians. A common factor of N(s) and D(s) is cancelled first.

Worked example

Take G(s) = 10 ÷ (s(s + 1)(s + 5)). |G(jω)| = 1 means ω²(ω² + 1)(ω² + 25) = 100, so with x = ω²: x³ + 26x² + 25x − 100 = 0. Its positive root is x = 1.5057, so ω_gc = 1.2271 rad/s.

The phase there is −90° − arctan 1.2271 − arctan 0.2454 = −154.61°, so PM = 180° − 154.61° = 25.39°. The delay margin is 25.39° × π ÷ 180 ÷ 1.2271 = 0.361 s.

For the second-order loop 4 ÷ (s(s + 2)), ω_n = 2 rad/s and ζ = 0.5: ω_gc ÷ ω_n = 0.786, so ω_gc = 1.572 rad/s and PM = arctan(1 ÷ 0.786) = 51.8°.

Limits you should know

  • The margins describe a loop closed with negative feedback (−1). They tell you how close the closed loop is to instability only when G(s) has no poles in the right half-plane and the usual Bode reading holds. The result counts the right half-plane poles and warns you; otherwise use the Nyquist test.
  • When there are several gain crossovers, the phase margin shown first is the one closest to 0°; the table lists all of them.
  • Polynomials up to degree 12 are accepted. With a time delay, phase crossovers are looked for only in the range of the charts.
  • The link between phase margin and damping ratio is exact only for the standard second-order loop. For other loops it is an estimate.
  • This is a study and design aid. It does not replace tests of the real system.

Related tools