ToolSphere

Bode Plot Generator

Electronics

Bode plot maker: type H(s) to plot magnitude and phase online with gain and phase margins, crossovers, poles, zeros and closed-loop stability.

Bode plot generator

Type a transfer function H(s) to get its magnitude and phase plots, gain and phase margins, poles and zeros.

Use s, numbers, + − * / ^ and brackets. Multiplication can be implied: 10(s+1)/(s^2(s+10)).

Gain margin
9.54 dB
Phase crossover ω
2.236 rad/s
Phase margin
25.4°
Gain crossover ω
1.227 rad/s

Closed loop with unity negative feedback: stable. Decided from the roots of den(s) + num(s), so it also covers conditionally stable loops and right-half-plane poles or zeros.

Magnitude

0.010.11101001000-180-160-140-120-100-80-60-40-200204060gain crossoverMagnitude (dB)

Phase

0.010.11101001000-270-225-180-135-90phase crossoverPhase (°)

Frequency ω (rad/s), logarithmic

Poles

-5, -1, 0

Zeros

none

Closed-loop poles

-5.418, -0.291 − 1.327j, -0.291 + 1.327j

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use Bode Plot Generator

  1. 1Type the open-loop transfer function H(s), for example 10/(s(s+1)(s+5)), or click one of the example buttons.
  2. 2Read the magnitude (dB) and phase (degrees) plots against ω in rad/s on a logarithmic axis.
  3. 3Check the gain margin, phase margin and crossover frequencies; the crossovers are marked on the plots.
  4. 4Read the closed-loop verdict and the closed-loop poles for unity negative feedback, and any notes about conditional stability or right-half-plane roots.
  5. 5Use the open-loop poles and zeros to see where the corners and phase changes in the plots come from.

About Bode Plot Generator

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.

Guides and tutorials

Frequently asked questions

How do I make a Bode plot online?

Type the transfer function in the H(s) box, for example 10/(s(s+1)(s+5)), and the magnitude and phase plots update as you type. The frequency range is chosen automatically from the poles and zeros.

How do I enter a transfer function?

Use s, numbers, + − * / ^ and brackets, written as in a textbook. Multiplication can be implied, so 10(s+1) and s(s+2) both work. Powers must be whole numbers up to 12.

What are gain margin and phase margin?

The phase margin is 180° plus the phase where the magnitude crosses 0 dB. The gain margin is how far the magnitude is below 0 dB where the phase crosses −180°. Larger margins mean a loop is further from instability.

What is a good phase margin and gain margin?

Common design targets are a phase margin of about 45° to 60° and a gain margin above about 6 dB. Smaller margins usually mean more overshoot and ringing in the step response.

How does the tool decide whether the system is stable?

It finds the roots of den(s) + num(s), the closed-loop characteristic polynomial for unity negative feedback. All roots in the left half-plane means stable, any on the jω axis means marginal, and any in the right half-plane means unstable.

Why is the gain margin negative when the tool says the loop is stable?

That happens with conditionally stable loops, where the phase starts below −180° and rises through it. The first crossing gives a negative gain margin, but the closed-loop poles are all stable. The page flags this disagreement.

Why does a margin show a dash?

If the magnitude never crosses 0 dB there is no phase margin, and if the phase never crosses −180° there is no gain margin. For example, 1/(s+1) never reaches −180°.

Is the frequency axis in hertz or rad/s?

It is angular frequency ω in rad/s. Divide by 2π to get hertz, so 1 rad/s is about 0.159 Hz.

Can it handle time delay, right-half-plane poles or discrete systems?

Time delays and z-domain transfer functions are not supported. Right-half-plane poles and zeros are plotted and counted in the closed-loop verdict, but the margins alone do not decide stability for them.

Should I enter the open-loop or closed-loop transfer function?

Enter the open-loop transfer function L(s), the controller times the plant. The margins and the closed-loop poles are both computed from it, assuming unity negative feedback.

Have a suggestion for Bode Plot Generator?Share your feedback ↗