Type the numerator and denominator of a transfer function G(s) as expressions in s, such as 10, s^2 + 3s + 2 or (s+1)(s+2), to draw the magnitude and phase against angular frequency ω (the Bode plot). Treating G(s) as an open-loop transfer function, the tool also finds the phase and gain margins.
Favorites and recently used calculators are stored only in this browser (localStorage).
Results
Gain crossover ωgc (0 dB)
–
Phase margin
–
Phase crossover ωpc (−180°)
–
Gain margin
–
DC gain G(0)
–
Closed loop with unity feedback
–
Poles (roots of denominator)
–
Zeros (roots of numerator)
–
The horizontal axis is angular frequency ω [rad/s] on a log scale (frequency f [Hz] = ω/2π). The dashed lines mark 0 dB and −180°, and the red dots mark the crossover frequencies. A gain margin of "Infinite" means the phase never reaches −180°. Closed-loop stability is judged from whether all roots of the unity-feedback loop G/(1+G) have negative real parts; with dead time this cannot be computed, so judge from the margins.
See it as a graph
Other inputs stay at their current values while the chosen input varies from 1/4 to 4 times its current value. The red dot is the current value.
Reading a Bode plot
A Bode plot is a pair of graphs showing, against angular frequency ω, how much a sine wave is amplified (magnitude) and how much it is shifted in phase. The horizontal axis is logarithmic and magnitude is in decibels, 20·log10|G(jω)|. On log scales the magnitude and phase of cascaded transfer functions add, so you can build the overall plot from the plots of each factor. A first-order lag 1/(Ts+1) is almost flat up to the corner frequency 1/T and then falls by 20 dB per decade, while the phase goes from 0° to −90°. At the corner the magnitude is −3 dB and the phase is −45°.
Phase margin and gain margin
The stability margins of a feedback loop can be read from the Bode plot of the open-loop transfer function. At the frequency where the magnitude is 0 dB (gain crossover), the phase margin is how far the phase is from −180°. At the frequency where the phase is −180° (phase crossover), the gain margin is how far the magnitude is below 0 dB. For the example 1/(s(s+1)), ωgc ≈ 0.786 rad/s and the phase margin is about 52°. For 10/((s+1)(s+2)(s+3)), ωpc = √11 ≈ 3.32 rad/s and the gain margin is about 15.6 dB, so raising the gain about sixfold to 60 makes the loop marginally stable. Common guides are a phase margin of 40–60° and a gain margin of about 10 dB or more.
Poles, zeros and the shape of the plot
Poles are values of s that make the denominator zero, and zeros make the numerator zero. A real pole in the left half-plane bends the magnitude down by 20 dB/decade from the frequency equal to its magnitude and adds up to 90° of phase lag. A zero does the opposite, raising the magnitude and adding phase lead. A pole at the origin (an integrator) adds −20 dB/decade and −90° at all frequencies. A pair of complex-conjugate poles produces a resonant peak near the natural frequency, higher for smaller damping ratio ζ. In the second-order example (ζ = 0.2) the peak appears near ω ≈ 1 rad/s.
The effect of dead time
A dead time e^(−Ls) leaves the magnitude unchanged but delays the phase by ωL radians. The lag grows with frequency, so dead time eats into the phase margin and lowers the gain at which the loop becomes unstable. For the example 2e^(−0.5s)/(s+1), the gain crossover is at √3 ≈ 1.73 rad/s, where the dead time adds about 50° of lag. The phase margin is about 70°; without the dead time it would be about 120°. With dead time the closed-loop roots cannot be found from a polynomial, so the tool asks you to judge stability from the margins.
AAt the corner angular frequency ω = 1/T the gain is about −3 dB and the phase −45°, and well above it the gain falls at −20 dB/dec
BAt the corner angular frequency ω = 1/T the gain is −6 dB and the phase −90°, and well above it the gain falls with a slope of −40 dB/dec
CThe gain is 0 dB at every frequency, and only the phase lags in proportion to frequency
Show answer and explanation
Answer: A. At the corner angular frequency ω = 1/T the gain is about −3 dB and the phase −45°, and well above it the gain falls at −20 dB/dec
The magnitude of G(jω) = 1/(1 + jωT) is 1/√(1 + (ωT)²), which is 1/√2 (about −3 dB) at ω = 1/T, where the phase is −45°. Well above 1/T the magnitude approaches 1/(ωT), and the gain falls by 20 dB for every tenfold increase in frequency (−20 dB/dec). The phase changes from 0° at low frequencies to −90° at high frequencies. In the straight-line approximation of the Bode plot, the gain is drawn as a horizontal 0 dB line below the corner and a −20 dB/dec line above it.
AThe gain is 0 dB at every frequency, and the phase is −90° at every frequency
BThe gain is a +20 dB/dec line passing through 0 dB at ω = 1 rad/s, and the phase is +90° at every frequency
CThe gain is a −20 dB/dec line passing through 0 dB at ω = 1 rad/s, and the phase is −90° at every frequency
Show answer and explanation
Answer: C. The gain is a −20 dB/dec line passing through 0 dB at ω = 1 rad/s, and the phase is −90° at every frequency
The magnitude of G(jω) = 1/(jω) is 1/ω, so it is 0 dB at ω = 1 rad/s and falls by 20 dB for every tenfold increase in frequency. Since 1/j = −j, the phase is −90° at every frequency. Because the gain grows without limit at low frequencies, a system containing an integrator can bring the steady-state error to a step setpoint to zero. A +20 dB/dec line with a phase of +90° belongs to a differentiator s.
The gain at low frequencies is 20 log₁₀10 = 20 dB. From 100 rad/s to 1000 rad/s it falls at −20 dB/dec and reaches 0 dB at 1000 rad/s; beyond that the second pole joins in and it falls at −40 dB/dec. From 1000 rad/s to 10⁴ rad/s is one decade, so the gain is 0 − 40 = −40 dB. The actual value is also about −40.04 dB; well away from the corners, the straight-line approximation fits closely.
AThe gain margin is the difference of the phase from −180° at the frequency where the gain is 0 dB, and the phase margin is the difference of the gain from 0 dB at the frequency where the phase is −180°
BThe gain margin is the difference of the gain from 0 dB at the frequency where the phase is −180°, and the phase margin is the difference of the phase from −180° at the frequency where the gain is 0 dB
CBoth the gain margin and the phase margin are read on the closed-loop Bode plot at the frequency where the gain is −3 dB
Show answer and explanation
Answer: B. The gain margin is the difference of the gain from 0 dB at the frequency where the phase is −180°, and the phase margin is the difference of the phase from −180° at the frequency where the gain is 0 dB
The gain margin is how many decibels the gain is below 0 dB at the phase crossover frequency, where the phase reaches −180°. The phase margin is how many degrees the phase still is from −180° at the gain crossover frequency, where the gain is 0 dB. Both measure how close the loop transfer function comes to the point −1 (gain 0 dB, phase −180°), and they are read from the loop transfer function, not the closed loop. For servo systems, a gain margin of about 10 to 20 dB and a phase margin of about 40 to 60° are common guidelines.
The phase is −90° − tan⁻¹ω − tan⁻¹(ω/2); the two angles add up to 90° when ω × (ω/2) = 1, so the phase reaches −180° at ω = √2 rad/s. The gain there is |L(j√2)| = 2/(√2 × √3 × √6) = 1/3, so the gain margin is 20 log₁₀3 ≈ 9.5 dB. Multiplying the gain by 3 (K = 6) would reach the limit, which agrees with the stable range 0 < K < 6 found with the Routh–Hurwitz stability criterion.
AThe overshoot becomes smaller and the oscillation disappears, but in exchange the rise of the response becomes slower
BThe phase margin is a frequency-response measure, so it does not affect the shape of the step response
CThe response tends to become faster, but the overshoot becomes larger and the oscillation takes longer to die out
Show answer and explanation
Answer: C. The response tends to become faster, but the overshoot becomes larger and the oscillation takes longer to die out
Raising the gain raises the gain crossover frequency and makes the response faster, but a smaller phase margin lowers the damping ratio of the closed loop. As a rule of thumb, the damping ratio ζ is estimated at about one hundredth of the phase margin in degrees. For the standard system whose loop transfer function is ωn²/(s(s + 2ζωn)), the overshoot is about 9% at a phase margin of 60° and about 42% at 30°. As the phase margin approaches zero the response approaches a sustained oscillation, and when it becomes negative the system is unstable.
FAQ
How much phase margin is enough?
40–60° is a common guide. A small phase margin means a larger overshoot in the closed-loop step response and a tendency to oscillate. In a second-order approximation, a phase margin of about 45° corresponds to a damping ratio of about 0.4, and about 60° to about 0.6. Leave extra margin for component tolerances and temperature changes.
How do dB values relate to gain ratios?
Gain in dB is 20·log10(ratio). A factor of 2 is about 6 dB, 10 is 20 dB, 1/√2 ≈ 0.707 is about −3 dB and 0.1 is −20 dB. A gain margin of 15.6 dB means the gain can rise about sixfold before the loop reaches the stability limit.
Why does the open-loop Bode plot tell you about closed-loop stability?
A unity-feedback loop G/(1 + G) becomes unstable when 1 + G(jω) = 0, that is, when G(jω) passes through or encircles the point with magnitude 1 and phase −180° (the Nyquist stability criterion). For the usual case of a stable open loop, the closed loop is stable if the magnitude is below 1 at the phase crossover frequency. If the open loop itself has unstable poles, you need to count encirclements on a Nyquist plot.