Bode Plot Back
Frequency Response

Bode Plot Generator

Quick answer
A Bode plot shows the gain |G(jω)|_dB=20·log₁₀|G(jω)| and phase ∠G(jω) versus frequency. Stability margins are evaluated by the gain margin GM=−20log₁₀|G(jω_pc)| and the phase margin PM=180°+∠G(jω_gc).

Real-time gain and phase plots for standard transfer functions. Automatic gain margin, phase margin and crossover frequency calculation with stability assessment.

Transfer Function
Transfer function type
Gain K
Time constant τ [s]
Enter coefficients high to low, comma-separated
Frequency Range
Min ω [rad/s]
Max ω [rad/s]
Signal animation — input vs output (see attenuation & phase lag)
A test-frequency sine wave (input) passes through the system H(jω) and you watch its amplitude shrink and phase lag grow in real time. Raise the frequency to see the rolloff attenuation and increasing phase delay.
This signal animation is linked to the transfer-function type and parameters (ωc, ζ, K…) in the left panel. The vertical line on the mini Bode plot below marks the current test frequency.
Stable
Results
Gain Margin [dB]
Phase Margin [°]
Gain xover ωgc [rad/s]
Phase xover ωpc [rad/s]
Gain plot [dB vs log ω]
Phase plot [° vs log ω]
Theory & Key Formulas

Gain (dB) and phase:

$$|G(j\omega)|_{\rm dB}=20\log_{10}|G(j\omega)|, \quad \angle G(j\omega)$$

Gain and phase margins:

$$GM = -20\log_{10}|G(j\omega_{pc})|\ [\text{dB}], \quad PM = 180°+\angle G(j\omega_{gc})$$

$\omega_{gc}$: frequency where $|G|=1$ (0 dB); $\omega_{pc}$: frequency where $\angle G=-180°$

What is a Bode Plot?

🙋
What exactly is a Bode plot, and why do engineers use it so much?
🎓
Basically, it's a two-part graph that shows how a system responds to different frequencies. The top plot shows the gain (amplification or attenuation) in decibels (dB), and the bottom shows the phase shift in degrees. Engineers use it because it lets you see stability and performance at a glance. Try changing the "Gain K" slider in the simulator above—you'll see the entire gain plot shift up or down, which is exactly how you'd tune a real amplifier or controller.
🙋
Wait, really? So the "phase margin" and "gain margin" that the tool calculates are about stability? What do they mean?
🎓
Exactly! They are safety buffers against oscillation. In practice, the gain margin tells you how much you can increase the gain before the system becomes unstable. The phase margin tells you how much extra phase lag you can add. For instance, in an aircraft's autopilot, you need large margins so turbulence doesn't cause dangerous oscillations. See the calculated margins in the simulator? Try reducing the "Damping ratio ζ" for a 2nd-order system—you'll see the phase margin shrink, warning you the system is becoming more oscillatory.
🙋
That makes sense. So what's the deal with the "resonance peak" I see in some of the plots? It looks like a big hump.
🎓
Great observation! That peak is a classic sign of low damping. A common case is a car's suspension—if the shock absorbers are worn (low damping), the car will oscillate violently at a specific "bounce" frequency. In the simulator, select the "2nd-order system" and set ζ below 0.7. You'll see a sharp peak appear at the natural frequency ωn. This tool calculates the exact peak frequency and magnitude, which is crucial for designing systems to avoid destructive vibrations.

Physical Model & Key Equations

The Bode plot is built from the system's transfer function G(s) evaluated at frequencies ω along the imaginary axis (s = jω). The gain in decibels and the phase are calculated as:

$$|G(j\omega)|_{\rm dB}=20\log_{10}|G(j\omega)|, \quad \angle G(j\omega)$$

Here, |G(jω)| is the magnitude of the complex number output. The logarithmic scale (dB) lets us turn multiplication of gains into simple addition, which is why the plots are often straight-line approximations.

Stability is quantified by the Gain Margin (GM) and Phase Margin (PM). They are found at two key frequencies:

$$GM = -20\log_{10}|G(j\omega_{pc})|\ [\text{dB}], \quad PM = 180°+\angle G(j\omega_{gc})$$

ωpc is the phase crossover frequency (where phase = -180°). GM is how much gain could be added before |G| = 1 at this frequency. ωgc is the gain crossover frequency (where |G| = 1 or 0 dB). PM is how much phase lag could be added before the phase hits -180° at this frequency. Positive margins generally mean a stable closed-loop system.

Frequently Asked Questions

Yes, that is correct. If the gain margin is negative (e.g., -5dB) or the phase margin is negative (e.g., -10°), the feedback control system is unstable. To ensure stability, it is generally recommended that the gain margin be +6dB or more and the phase margin be +30° or more. This tool automatically determines this, so please use it as a design guideline.
Yes, it is possible. This tool uses a numerical calculation engine to quickly calculate the frequency response of high-order transfer functions (e.g., 10th order or higher) and plot them in real time. However, if the order is extremely high (50th order or higher) or the frequency range is too wide, plotting may become slightly slower. In such cases, please narrow the frequency range.
The frequency at which the gain plot crosses 0dB is the 'gain crossover frequency,' and the frequency at which the phase plot crosses -180° is the 'phase crossover frequency.' For stability evaluation, check the phase margin at the gain crossover frequency (the difference between the phase at the 0dB point and -180°) and the gain margin at the phase crossover frequency (the difference between the gain at the -180° point and 0dB). The tool automatically calculates these, so you can use the values directly.
To increase the gain margin, lower the low-frequency gain or add a phase-lag compensator. To increase the phase margin, a phase-lead compensator that advances the phase near the gain crossover frequency is effective. Specifically, adjust by adding zeros or poles to the transfer function. While checking the results of changes in real time with the tool, try to adjust so that both margins meet the target values (GM ≥ 6dB, PM ≥ 30°).

Transfer Function, Gain and Phase

A Bode plot represents the frequency response of a system as a "gain plot" and a "phase plot". Substituting $s=j\omega$ into the transfer function $G(s)$ gives $G(j\omega)$, whose gain and phase are plotted against frequency $\omega$ (on a logarithmic axis).

Gain $[\text{dB}] = 20\log_{10}|G(j\omega)|, \qquad$ Phase $[\deg] = \angle G(j\omega)$

Because the gain is expressed in decibels (dB), the product of transfer functions (series connection) becomes an addition of plots, so even complex systems can be drawn by superimposing element by element. This is the greatest advantage of the Bode plot.

Bode Plots of First- and Second-Order Systems

A first-order lag system $G=\dfrac{1}{1+sT}$ rolls off at −20 dB/dec beyond the corner angular frequency $\omega=1/T$, and its phase changes from $0°\to-90°$ (with $-45°$ at the corner). A second-order system $G=\dfrac{\omega_n^2}{s^2+2\zeta\omega_n s+\omega_n^2}$ rolls off at $-40$ dB/dec, its phase goes from $0°\to-180°$, and when the damping ratio $\zeta$ is small a resonant peak appears near the natural angular frequency $\omega_n$.

ElementGain slopePhase
Integrator $1/s$$-20$ dB/dec$-90°$ (constant)
First-order lag $1/(1+sT)$$-20$ dB/dec after corner$0°\to-90°$
Second-order system$-40$ dB/dec after corner$0°\to-180°$

Stability Margins (Gain Margin and Phase Margin)

Bode plots are used to assess the stability of feedback systems. For the open-loop transfer function:

The larger and more positive both are, the more stable the system; typical guidelines are a phase margin of $30°\sim60°$ and a gain margin of $6$ dB or more. Small margins make the response oscillatory or unstable. In this simulator you can vary the parameters and observe how the plot and stability margins change.

Real-World Applications

Control System Design: This is the primary use. Engineers design feedback controllers for robots, drones, or chemical processes. They use Bode plots to visually tune gains (K) and adjust dynamics (τ, ωn) to achieve desired response speed (bandwidth) while ensuring robust stability margins, exactly as you can experiment with in this simulator.

Vibration & Acoustic Analysis: The resonance peak analysis is vital here. For instance, when designing a speaker enclosure or a bridge, engineers must ensure the natural frequencies (ωn) and damping (ζ) are such that resonance peaks are suppressed at expected forcing frequencies to prevent excessive noise or structural failure.

Power Electronics & Filter Design: Bode plots are used to design filters that block unwanted noise frequencies. The slope of the gain plot (e.g., -20 dB/decade for a 1st-order low-pass filter, adjustable with the time constant τ) shows how effectively a frequency is attenuated. This is key for clean power supplies and signal processing.

Aerospace & Automotive Stability: Flight control systems (fly-by-wire) and electronic stability programs in cars are classic examples. Engineers perform "loop shaping" using Bode plots to guarantee sufficient phase and gain margins so that the system remains stable under all expected operating conditions and delays.

Common Misconceptions and Points to Note

First, are you thinking "the larger the gain margin, the better"? Actually, that's not necessarily true. While a small margin certainly increases oscillation risk, one that's too large can make the system's response sluggish. For example, the step response can become extremely slow, or disturbance rejection can worsen. In practice, a guideline is roughly 6–20 dB for GM and 30–60 degrees for PM. Keep in mind the trade-off between performance and stability.

Next, when using "arbitrary coefficients" in the simulator, are you checking if the transfer function is "proper"? A proper transfer function is one where the denominator's degree is greater than or equal to the numerator's degree. For instance, (s+1)/(s^2+2s+5) is OK, but (s^2+1)/(s+1) has the degrees reversed (strictly speaking, it's not "strictly proper"). It's difficult to directly implement such an improper transfer function in a real control system (it would require future information!), so be careful during modeling.

Finally, are you relying solely on the Bode plot and feeling completely assured? The GM/PM from a Bode plot assumes a linear time-invariant system. Actual control plants often have nonlinearities (like saturation, friction, deadbands) or time-varying characteristics. For example, designing without considering motor output saturation can lead to oscillation in practice, even if the system is theoretically stable. Simulation results are only a "first approximation." Verification with real hardware testing is essential.

How to Use

  1. Enter the DC gain K1 (dimensionless) and time constant tau1 (seconds) for the first-order pole, or leave at default 1.0 and 0.1 s
  2. Input K2 (proportional gain) and natural frequency wn2 (rad/s) for second-order dynamics; typical wn2 ranges 10–100 rad/s for servo systems
  3. Click Generate to compute Bode magnitude and phase plots; the simulator automatically extracts gain margin (dB), phase margin (degrees), gain crossover frequency ωgc (rad/s), and phase crossover ωpc (rad/s)
  4. Adjust parameters iteratively to achieve phase margin ≥45° and gain margin ≥6 dB for robust closed-loop stability

Worked Example

A DC motor servo uses H(s) = (50 s)/(s + 20)(s² + 15s + 100). Setting K1 = 50, tau1 = 0.05 s, K2 = 100, wn2 = 10 rad/s produces: Gain Margin = 12.4 dB, Phase Margin = 58°, ωgc = 8.3 rad/s, ωpc = 22.1 rad/s. This exceeds stability margins; reducing K1 to 25 lowers gain margin to 6.1 dB while maintaining phase margin at 42°, confirming the system approaches instability near the reduced gain.

Practical Notes

  1. PID controller tuning: increase K1 to raise crossover frequency but monitor phase margin erosion; typical industrial setpoint for phase margin is 50–60°
  2. Resonant peaks in the magnitude plot above the second-order break frequency indicate insufficient damping; increase wn2 or add compensator zeros
  3. Gain crossover must precede phase crossover (ωgc < ωpc) for stability; violation signals non-minimum phase behavior requiring lead compensation
  4. For hydraulic actuator systems (wn2 ≈ 15–30 rad/s, damping ratio ~0.7), verify gain margin >8 dB to account for friction nonlinearity

Standards & Assumptions

Standard / reference: Classical control — frequency response. Substitute \(s=j\omega\): \(|G(j\omega)|_{dB}=20\log_{10}|G|\), phase \(\angle G(j\omega)\). Margins \(GM=-20\log_{10}|G(j\omega_{pc})|\), \(PM=180^\circ+\angle G(j\omega_{gc})\).

Model assumptions: LTI; one element evaluated at a time (first-order, second-order, integrator, PD, custom polynomial). No series cascading, time delay or discretization. Second-order is \(K\omega_n^2/(s^2+2\zeta\omega_n s+\omega_n^2)\).

Scope & limits: Educational / analysis. Verified: first-order at \(\omega=1/\tau\) gives −3.01 dB / −45°; second-order \(\zeta=0.5,\omega_n=10\) gives |G|=1 / −90° at \(\omega=\omega_n\), matching the tool. For full open-loop margins use a cascaded model.