What this Bode plot generator does
Type a transfer function H(s) and the page draws its Bode diagram: magnitude in decibels and phase in degrees, both against angular frequency ω in rad/s on a logarithmic axis. It also reports the gain margin, the phase margin, the two crossover frequencies, the open-loop poles and zeros, and the closed-loop poles you get when H(s) sits in a unity negative-feedback loop. Use it as a Bode plotter for control homework, for checking a compensator before you simulate it, or for seeing how a filter treats each frequency.
The input is a rational function of s: numbers, s, + − * / ^ and brackets, with implied multiplication, so 10/(s(s+1)(s+5)), (s+2)/(s^2+0.4s+4) and 100(s+1)/(s^2(s+10)) all work. Powers must be whole numbers up to 12. There is no time-delay term (e to the minus sT), no discrete-time z-domain input and no file export; the plots are drawn on screen.
How the plot is built
The expression is expanded into a numerator and a denominator polynomial. The tool evaluates H(jω) at 601 logarithmically spaced frequencies and plots 20·log₁₀|H(jω)| and the angle of H(jω). The frequency range is automatic: two decades below the smallest nonzero pole or zero and two decades above the largest. Phase is unwrapped so it stays continuous, and it starts on the low-frequency asymptote: 90° for each net zero at the origin minus 90° for each net pole there, and −180° more if the low-frequency gain is negative. So a triple integrator 1/s³ starts at −270°, not at +90°.
Each real pole bends the magnitude down by 20 dB per decade and pulls the phase down by up to 90°; each real zero does the opposite. A lightly damped complex pair produces a resonant peak and a fast 180° phase drop. Poles and zeros are found numerically and rounded to six decimal places.
Gain margin, phase margin and stability
The phase margin is 180° plus the phase at the gain crossover, the frequency where the magnitude is 0 dB. The gain margin is minus the magnitude in dB at the phase crossover, where the phase is −180°. A missing crossover shows as a dash: 1/(s+1) never reaches −180°, so it has no gain margin. If a curve crosses more than once, the margins use the first crossing.
The stable or unstable verdict does not come from the margins. The tool computes the closed-loop characteristic polynomial den(s) + num(s) and checks its roots: all in the left half-plane means stable, any on the jω axis means marginally stable, and any in the right half-plane means unstable. That stays correct in the cases where reading margins goes wrong: conditionally stable loops, loops with several crossings, and open loops with right-half-plane poles or zeros. When the margins and the closed-loop poles disagree, the page says so.
Worked example: 10/(s(s+1)(s+5))
This is the default example. The phase reaches −180° at ω = √5 ≈ 2.236 rad/s, where |H| = 1/3, so the gain margin is 20·log₁₀3 ≈ 9.54 dB. The magnitude crosses 0 dB at 1.227 rad/s with a phase margin of 25.4°. The closed-loop poles are −5.418 and −0.291 ± 1.327j, so the loop is stable but lightly damped.
Changing only the gain K in K/(s(s+1)(s+5)) moves the magnitude curve up or down while the phase stays the same:
| K | Gain crossover (rad/s) | Phase margin | Gain margin | Closed loop |
|---|---|---|---|---|
| 2 | 0.374 | 65.2° | 23.52 dB | stable |
| 10 | 1.227 | 25.4° | 9.54 dB | stable |
| 20 | 1.815 | 8.9° | 3.52 dB | stable |
| 30 | 2.236 | 0.0° | 0.00 dB | marginal, poles at ±2.236j |
| 40 | 2.575 | −6.0° | −2.50 dB | unstable, poles at 0.114 ± 2.532j |
K = 30 is where the gain margin runs out: 10 × 3 = 30, matching the Routh–Hurwitz condition 6 × 5 = K for s³ + 6s² + 5s + K. Notice how the closed-loop poles move toward the jω axis as the phase margin shrinks.
Cases where the margins mislead
- 1/s³: phase −270° at every frequency, phase margin −90°, closed-loop poles 0.5 ± 0.866j and −1. Unstable.
- 100(s+1)²/(s³(s+100)): the phase starts below −180° and rises through it, so the first gain margin is −5.85 dB, yet every closed-loop pole (−99.01, −0.57, −0.21 ± 1.314j) is in the left half-plane. This is a conditionally stable loop: dropping the gain from 100 to 50 moves two closed-loop poles to 0.004 ± 1.002j, which is unstable.
- 5(s−1)/(s+1)²: a right-half-plane zero. The closed loop s² + 7s − 4 has a pole at +0.531, so it is unstable.
For these, trust the closed-loop poles, or draw a Nyquist plot.
Reading the plot for filters
For a filter rather than a loop, read the magnitude curve directly. The first-order low-pass 1/(s+1) is −0.04 dB at 0.1 rad/s, −3.01 dB and −45° at its corner of 1 rad/s, and −20.04 dB at 10 rad/s. The underdamped 1/(s²+0.2s+1) peaks at 13.99 dB near 1 rad/s because its damping ratio is 0.1. The lead compensator 10(s+1)/(s+10) adds a maximum of 54.9° of phase at √10 ≈ 3.16 rad/s, the geometric mean of its zero and pole.
The axis is in rad/s. To convert to hertz, divide by 2π: 1 rad/s is about 0.159 Hz.
Common mistakes
- Mixing up hertz and rad/s. A corner at 1 kHz is a pole at s = −6283, not s = −1000.
- Forgetting the s in front of a factor. 10/((s+1)(s+5)) has no integrator and a very different low-frequency phase from 10/(s(s+1)(s+5)).
- Entering the closed-loop transfer function and reading its margins. Margins belong to the open loop L(s) = C(s)G(s).
- Treating 1/(s+1)^0.5 as valid. Fractional powers are rejected.
Related tools and guides
The Bode gain and phase margin example works the default case by hand. For loop design, the PID tuning helper and the PID tuning guide take the next step. For passive filters, the RC filter calculator finds the corner frequency from component values.