ProjekinAja. Robotics Stage 3 · Dynamics Control Lesson 3.6
● Stage 3 · Lesson 3.6

Frequency-Domain Analysis: Bode Plots and Robustness Margins

Gain margin and phase margin are not performance metrics — they are the quantitative answer to 'how wrong can my model be before the controller goes unstable?'

⏱ ~24 min read 📊 Control theory 🚨 Robustness critical

🎯 By the end you'll understand

How the frequency response of a linear system encodes everything about its stability. What Bode magnitude and phase plots actually show and how to read them quickly. The gain crossover frequency as the bandwidth of your closed loop. Gain margin and phase margin as quantitative robustness certificates: how much your model can be wrong before the controller destabilizes the real hardware. Why 6 dB gain margin and 30° phase margin are practical engineering minima rather than aesthetic preferences. How root locus extends the picture to pole placement. Lead and lag compensators as the designer's vocabulary for shaping margins. And the critical failure mode: a high-bandwidth PID that looks great on an ideal motor and goes unstable the moment drivetrain compliance adds a lightly-damped resonance.

KEY INSIGHTMargins answer a question PID gains cannot

Your PID has Kp = 12, Ki = 0.8, Kd = 0.6. Is that controller safe to deploy? Those three numbers cannot tell you. Gain margin and phase margin can — they tell you how much your plant model can be wrong before the real hardware oscillates to destruction.

After Lesson 3.4 gave you PID and Lesson 3.5 gave you Lyapunov stability, you might assume the hard part is over. It isn't. Both of those tools answer "does this controller stabilize this model?" The harder engineering question is "does this controller stabilize the real physical system, which is not exactly your model?" That is robustness — and it has a precise, computable answer in the frequency domain.

🔑 The fundamental insight

A closed-loop system goes unstable when a sinusoidal signal at some frequency can travel around the feedback loop, arrive back at its origin with the same phase (0° net shift, which means the feedback is now positive rather than negative) and with gain ≥ 1 (so it grows rather than decays). Gain margin and phase margin measure how far your loop is from that catastrophic condition at every frequency. They are not performance metrics. They are certificates of how much model error you can tolerate.

CORE CONCEPTFrequency response: what a system does to a sinusoid

For any linear time-invariant (LTI) system, if you inject a sinusoid at the input, the steady-state output is a sinusoid at the same frequency — but with different amplitude and a phase shift. This is the frequency response. It is completely characterised by the transfer function G(s) evaluated on the imaginary axis: G(jω) for each frequency ω.

Written in polar form, G(jω) = |G(jω)| · ejφ(ω) where:

For a second-order plant with a natural frequency ωn and damping ratio ζ — exactly the kind of model FollowBot's arm joint produces when you include the motor and load inertia — the transfer function is:

📖 Second-order plant transfer function

G(s) = ωn2 / (s2 + 2ζωns + ωn2)

At low frequencies (ω ≪ ωn): |G| ≈ 1, φ ≈ 0°. The system passes low-frequency signals unmodified.
At ω = ωn: |G| = 1/(2ζ). With low damping this is a resonance peak — the system amplifies near its natural frequency.
At high frequencies (ω ≫ ωn): |G| ∝ 1/ω2, so magnitude rolls off at −40 dB/decade, and phase approaches −180°.

That −180° phase at high frequency is critical: it means high-frequency feedback is positive feedback. If your loop gain is still ≥ 1 when phase reaches −180°, the system is unstable.

HOW IT WORKSReading a Bode plot: magnitude, phase, crossover

A Bode plot is two graphs stacked vertically sharing the same logarithmic frequency axis (rad/s or Hz). The top plot shows magnitude in decibels (20·log₁₀|G|), the bottom shows phase in degrees. Logarithmic frequency axis is essential — it spreads out decades of frequency behavior that a linear axis would crush together.

MAGNITUDE (dB) 0 20 -20 ωgc gain crossover ωpc GM ~10 dB PHASE (°) -180 0 -90 PM ≈ 42° 0.01 0.1 1 10 100 Frequency ω (rad/s)
Annotated Bode plot for a compensated 2nd-order plant. Top: magnitude in dB. Bottom: phase in degrees. The gain crossover frequency ωgc (where |G| = 0 dB) is the bandwidth of the closed loop. Phase margin (PM) is how many degrees of additional phase lag would bring the phase to −180° at ωgc. Gain margin (GM) is how many dB of additional gain would bring |G| to 0 dB at the phase crossover frequency ωpc.

Three numbers to extract from every Bode plot:

1

Gain crossover frequency ωgc — the bandwidth

The frequency where the open-loop magnitude crosses 0 dB (gain = 1). This is approximately the bandwidth of the closed-loop system — the highest frequency input the robot will follow. Too low: the robot responds sluggishly. Too high: the controller amplifies high-frequency noise and, critically, risks running into plant resonances you did not model. The gain crossover frequency is your primary bandwidth knob.

2

Phase margin (PM) — tolerance to phase lag

At ωgc, measure the phase. Phase margin = 180° + φ(ωgc). Since φ is negative (systems are causal; output lags input), PM = 180° − |φ(ωgc)|. PM answers: how many additional degrees of phase lag (from unmodelled delays, resonances, or parameter variation) can the system absorb before going unstable? A PM of 30° means if your actuator adds 35° of lag you didn't model, the controller destabilizes. Practically, target PM ≥ 45° for comfort; 30° is the engineering minimum.

3

Gain margin (GM) — tolerance to gain increase

At the phase crossover frequency ωpc (where phase = −180°), the magnitude is below 0 dB by some amount. That amount in dB is the gain margin. GM answers: how much could the plant gain increase (from temperature, payload, friction loss) before the system goes unstable at that frequency? 6 dB means the plant gain can double before instability. Target GM ≥ 6 dB as a practical minimum; 10–20 dB is comfortable for hardware that may carry variable loads.

CORE CONCEPTWhy 6 dB and 30° are practical minima

These numbers are not arbitrary. They come from the engineering reality of robot hardware.

6 dB gain margin: A factor-of-2 gain increase. Motor winding resistance changes ~10% per 50°C. Payload variation on a manipulator arm can change the effective plant gain by 2–3×. Battery voltage drop from full to cutoff is ~20% for lithium cells, which shifts motor gain. Even cable routing affects joint friction by 15–30%. A 6 dB GM says: your model can be wrong on the gain by a factor of 2 and the controller still stabilizes. Less than that, and routine hardware variation — temperature, load, battery state — can destabilize the system.

30° phase margin: A pure time delay of T seconds adds phase lag of −ωT radians = −57.3·ω·T degrees at frequency ω. If your controller bandwidth is ωgc = 10 rad/s and you have an unmodelled 30 ms delay (plausible for USB-serial actuator communication), that delay adds −57.3 × 10 × 0.03 ≈ −17° of phase. If your PM was only 20° you are now at 3°, barely stable. At 30 ms and 50 rad/s bandwidth the same delay costs −86°. The 30° minimum is a sanity margin against discrete-time delays, actuator lag, and computation time that weren't in the continuous-time model.

💡 PM and transient response are coupled

The closed-loop step response overshoot and settling time are tightly related to phase margin. A PM of 45° corresponds roughly to a damping ratio ζ ≈ 0.45 in the closed-loop dominant poles, giving about 20% overshoot. A PM of 65° gives ζ ≈ 0.7, roughly 5% overshoot. The relationship is not exact (it assumes a second-order dominant-pole approximation) but it is a reliable first estimate: phase margin is not just a safety budget, it shapes your transient response. A controller with PM = 15° will ring noticeably on every step. One with PM = 70° will be well-damped but slow. The sweet spot for most robot joints is 45–60°.

SEE ITBode + Root Locus paired explorer

Design a lead compensator for a 2nd-order plant. Move the compensator zero and pole, change the loop gain. Watch both Bode plots and the root locus update simultaneously. The goal: find settings that give GM ≥ 10 dB and PM ≥ 45°, then drag gain upward until the root locus crosses the imaginary axis and the system goes unstable. Notice exactly how much margin you had — and how little room for error is left at maximum gain.

⚙ Interactive · Bode + Root Locus paired explorer

Adjust the lead compensator (zero, pole, gain) for a 2nd-order plant. Both Bode plots and root locus update in real time. Red zone = unstable. Can you achieve GM ≥ 10 dB and PM ≥ 45° simultaneously?

2.0
10.0
4.0
0.40
GM: — dB PM: — ° BW: — rad/s STABLE
Bode — Magnitude (dB)
Bode — Phase (°)
Root Locus (s-plane)
Adjust the compensator. Watch gain margin (red dashed line on Bode) and phase margin (gold marker) change. Drag K above the stability threshold to see the root locus cross into the right half-plane.

The widget reveals the core design tension: increasing gain K pushes the bandwidth up (better tracking speed) but erodes both margins. The compensator zero zc adds phase lead at the crossover frequency (boosting PM), but placing it too high reduces its effect. The pole pc provides high-frequency rolloff (restoring GM) but adds phase lag above it. Neither margin can be improved without affecting the other — and both degrade as K increases toward the instability boundary.

IN PRACTICELead and lag compensators

A PID controller is a specific compensator. The frequency-domain vocabulary gives you two more building blocks that are often more transparent to design.

Compensator Transfer function What it does Use it when
Lead K(s + zc)/(s + pc), pc > zc Adds phase lead between zc and pc; boosts PM; high-frequency gain is K·pc/zc PM is too small; need faster step response; can tolerate more high-frequency gain
Lag K(s + zc)/(s + pc), pc < zc Attenuates high-frequency gain; boosts low-frequency gain for better steady-state; adds slight phase lag near crossover GM needs improvement; steady-state error is too large; bandwidth is already adequate
Lead-lag Product of both Simultaneous phase boost at midfrequencies and attenuation at high frequencies Both PM and steady-state performance need improvement; plant has significant phase lag
Notch (s2+2ζzωns+ωn2)/(s2+2ζpωns+ωn2) Deep magnitude notch at resonance frequency; suppresses lightly-damped resonance peak Drivetrain compliance adds a resonance peak in the plant; without the notch the loop goes unstable at resonance

The notch filter in that last row is not optional for compliant drivetrains — it is the mechanism that makes the failure mode described below fixable. A lead compensator alone cannot save you once a resonance peak has pushed the magnitude above 0 dB at the phase-crossover frequency.

💡 PID in frequency-domain terms

A PID controller with transfer function Kp(1 + 1/(Tis) + Tds) is a lead-lag compensator in disguise. The derivative term Tds adds phase lead at high frequencies (boosting PM). The integral term 1/(Tis) adds phase lag at low frequencies (improving steady-state error at the cost of PM near crossover). Frequency-domain design gives you direct control over where in frequency these effects land. Ziegler-Nichols (Lesson 3.4) tunes by rules of thumb; loop-shaping places them by specification.

WEAKNESSThe drivetrain resonance failure — the critical failure mode

Here is the failure scenario from the lesson brief, stated precisely. It is one of the most common sources of hardware instability in robot arms and is responsible for the destruction of more than a few first-prototype manipulators.

You have a motor driving a load through a gearbox and a flexible coupling. In your model, you treated the drivetrain as rigid: the gearbox output shaft and the load are the same inertia. Your PID is tuned on this model and looks great — 48° phase margin, 12 dB gain margin, smooth step response.

Real drivetrains are not rigid. The flexible coupling has a spring constant k and the load inertia JL introduces a lightly-damped resonance at:

📖 Drivetrain resonance frequency

ωres = √(k · (1/Jm,reflected + 1/JL))

This simplifies to √(k/JL) only when the reflected motor inertia Jm,reflected ≫ JL (high gear ratio limit). In the general 2-inertia case, both inertias contribute and ignoring the motor term underestimates ωres, placing your notch filter at the wrong frequency. This resonance appears in the actual plant as a sharp peak in the Bode magnitude plot — potentially 20–30 dB above the baseline at ωres. If ωres falls within or near your control bandwidth, that peak can push the open-loop magnitude through 0 dB at a frequency where the phase is already near −180°, instantly violating both margins simultaneously.

The consequences: the controller, which looked robustly stable on the rigid model, sees a gain of +20 dB at a frequency it was designed to handle. That 20 dB turns your 12 dB gain margin into a deficit of −8 dB. The system goes unstable. On a motor-arm system this manifests as a high-pitched oscillation — the joint resonates audibly and can saturate or destroy the actuator if the oscillation amplitude grows.

0 dB 20 -20 rigid model (designed on this) resonance peak ωgc (designed) Rigid model (GM = 12 dB) Compliant drivetrain (GM ≈ −8 dB → unstable)
The resonance failure mode. The rigid model (dashed, teal) shows a clean rolloff — 12 dB gain margin looks safe. The compliant drivetrain (solid red) adds a sharp resonance peak that passes through 0 dB near the phase-crossover frequency. The gain margin is now negative: the system is unstable. The controller was not poorly designed; the model was wrong.

The fix is not retuning the PID. The fix is:

  1. Identify the resonance frequency: sweep a sinusoidal input across frequencies and measure the velocity response (or use a spectrum analyzer on the velocity signal during normal operation — the resonance appears as a sharp peak).
  2. Add a notch filter tuned to ωres in the forward path. This suppresses the magnitude peak and restores the gain margin.
  3. Or reduce bandwidth below ωres. This avoids the resonance entirely but sacrifices tracking speed. Often the only option when the resonance is not well-characterized.

The deeper lesson: your Bode plot is only as good as your plant model. A model that omits drivetrain compliance will produce margins that look adequate on paper and fail in hardware. This is the frequency-domain version of the sim-to-real gap.

FOLLOWBOTTuning FollowBot's arm velocity loop via loop-shaping

From the Stage 3 milestone: FollowBot's 6-DOF arm has a PID velocity controller tuned to a quantitative settling-time spec using Ziegler-Nichols and refined via root locus. Here is how the frequency-domain analysis fits into that pipeline and what it adds.

The joint closest to the base (joint 1) carries the highest inertia because it rotates the rest of the arm. At full arm extension carrying the maximum payload (0.5 kg), the effective inertia seen at the joint is approximately:

📖 FollowBot joint 1 — estimated plant parameters

Gmotor+joint(s) = 1 / (J·s2 + b·s)

J = 0.04 kg·m² (motor inertia + reflected load inertia at gear ratio N=50), b = 0.12 N·m·s/rad (viscous friction + back-EMF coefficient). Natural frequency ωn ≈ 8 rad/s, damping ratio ζ ≈ 0.19 (lightly damped — the arm has low friction relative to inertia). The lightly-damped open-loop poles are at −1.5 ± 7.9j — they are close to the imaginary axis, making the system sensitive to gain increases.

bode_analysis.pyPython · control library · FollowBot joint analysis
import numpy as np
import control  # pip install control

# FollowBot joint 1: velocity plant (torque input, velocity output)
J, b = 0.04, 0.12
# G(s) = 1/(J*s + b)  — velocity TF (integrator in position loop only)
G_plant = control.tf([1], [J, b])   # first-order for velocity

# Lead compensator: zero at 2 rad/s, pole at 14 rad/s, gain = 5
z_c, p_c, K_lead = 2.0, 14.0, 5.0
C_lead = K_lead * control.tf([1, z_c], [1, p_c])

# Open loop: L(s) = C(s) * G(s)
L = C_lead * G_plant

# Margins
gm, pm, wpc, wgc = control.margin(L)
print(f"Gain margin:  {20*np.log10(gm):.1f} dB  (at ω={wpc:.2f} rad/s)")
print(f"Phase margin: {pm:.1f}°         (at ω={wgc:.2f} rad/s)")
# Typical output: GM ~14 dB, PM ~52°

# Closed-loop step response
T_cl = control.feedback(L, 1)
t, y = control.step_response(T_cl)
# Check settling time to 2% tolerance

The critical check after tuning: inject FollowBot's belt-drive compliance into the model. Joint 3 uses a timing belt with a measured stiffness of approximately 800 N·m/rad. The anti-resonance from this compliance appears at ωres ≈ 22 rad/s — squarely in the frequency range of the compensated loop bandwidth (~15 rad/s). Without a notch filter, the resonance peak eats into the gain margin. Adding a notch at 22 rad/s with Q = 4 restores ~8 dB of margin at that frequency.

🔑 FollowBot figure-eight trajectory validation

The Stage 3 milestone requires cross-track error below spec during a figure-eight trajectory. The frequency content of a figure-eight is dominated by harmonics of the traversal frequency — if your traversal takes 8 seconds, the fundamental is at 0.125 Hz ≈ 0.79 rad/s, with significant energy at 2× and 3× harmonics. Your loop bandwidth at ωgc must comfortably exceed the highest significant harmonic, and your phase margin must be large enough that the phase lag at those harmonics doesn't cause tracking error to grow. A bandwidth-limited controller with PM = 50° will have small but nonzero phase lag at the trajectory harmonics — that lag directly predicts the steady-state cross-track error. This is the quantitative connection between Bode analysis and trajectory tracking performance.

WEAKNESSWhere this bites

✗ Designing margins on the rigid-body model and deploying on hardware with compliance

The most common real-world failure pattern: your simulation has ideal rigid links; the Bode analysis on that model shows 15 dB GM and 55° PM. You tune a lead compensator, verify in simulation, deploy to hardware. Within seconds the joint oscillates at a frequency you didn't model. The resonance from belt compliance, flexible coupling, or gearbox elasticity was not in your plant model. The fix: physically measure the plant frequency response before finalizing the compensator. A swept-sine test (command a sinusoidal velocity reference at frequencies from 0.1 to 100 rad/s, record the output) takes 10 minutes and reveals every resonance. Never trust a model you haven't validated in frequency domain against the real hardware.

✗ Treating the Nyquist criterion as equivalent to Bode margins

Bode gain and phase margins assume the open-loop transfer function has a single gain-crossover frequency and a single phase-crossover frequency. Most simple plants satisfy this. But a plant with a lightly-damped resonance can have multiple crossover frequencies — the Bode diagram can cross 0 dB multiple times, and the phase can cross −180° multiple times. In these cases, reading GM and PM from the first crossing gives you a false sense of security: the loop may be stable at that crossing but unstable at a higher-frequency crossing you didn't check. The correct tool for multi-crossover plants is the full Nyquist plot (or the Nichols chart). Bode margins are a simplification valid for minimum-phase, single-crossover plants — confirm that assumption before using them as your only robustness certificate.

✗ Confusing loop bandwidth with controller bandwidth or sampling rate

Loop bandwidth (ωgc) is the frequency up to which the closed-loop tracks references well. This is not the same as the controller update rate. A discrete controller running at 1 kHz (6283 rad/s) can have a loop bandwidth of 20 rad/s — and should, for a mechanical system. The relationship is approximately ωgc ≤ ωsample/10 for adequate phase margin after discretization (a 1 kHz controller starts adding significant phase lag above ~60 rad/s). Engineers who conflate "I'm running my controller at 1 kHz so I have 1 kHz bandwidth" will design a loop that looks fine in continuous time and oscillates after discretization, because the zero-order hold in discrete implementation adds phase lag of approximately −ω·Ts/2 radians at frequency ω. At ωgc = 600 rad/s with Ts = 1 ms, this is −17° of additional phase lag the Bode analysis didn't include.

KEY INSIGHTHow it connects

  • 3.4 · PID Control: Derivation, Tuning, and When It Fails — PID is the starting point; Bode analysis gives it a rigorous stability guarantee. The Ziegler-Nichols rules implicitly target PM ≈ 30°; loop-shaping lets you do better deliberately. Understanding PID in frequency-domain terms (lead-lag interpretation) makes compensator design systematic rather than heuristic.
  • 3.5 · Stability: Lyapunov Theory and Phase Portraits — Lyapunov stability is qualitative ("does it converge?"); Bode margins are quantitative ("how much perturbation until it doesn't?"). For nonlinear systems Lyapunov is the right framework; for LTI systems near an operating point, frequency-domain margins give sharper answers faster. The two frameworks are complementary, not competing.
  • 3.7 · Feedforward and Computed-Torque Control — Frequency-domain analysis shapes the feedback loop (what errors can the controller reject?). Feedforward reduces the tracking error that the feedback loop has to reject in the first place. The two are designed together: the feedforward model accuracy determines the disturbance spectrum the feedback loop must handle, which sets the bandwidth requirement, which sets the margin targets.

Frequency-domain analysis is the bridge between the theory of Stages 1–3 and the practice of Stage 6 (sim-to-real deployment). Every time you deploy a controller to hardware, you are implicitly asking "how wrong is my model and does my margin cover that error?" This is the question Bode plots answer. Get comfortable answering it before any hardware trial.

GLOSSARYKey terms

Frequency response
The mapping from sinusoidal input frequency to the amplitude ratio (magnitude) and phase shift of the steady-state sinusoidal output. For an LTI system, fully characterised by G(jω). The Bode plot is its graphical representation.
Gain crossover frequency (ωgc)
The frequency at which the open-loop magnitude |G(jω)| = 1 (0 dB). Approximately equals the closed-loop bandwidth — the highest frequency the controller can effectively track or reject disturbances at.
Phase margin (PM)
The additional phase lag (in degrees) that would bring the open-loop phase to −180° at the gain crossover frequency. PM = 180° + ∠G(jωgc). Quantifies robustness to unmodelled time delays, resonances, and parameter variation. Practical minimum: 30°.
Gain margin (GM)
The factor by which the open-loop gain could be increased (in dB) before the system becomes unstable, measured at the phase crossover frequency ωpc where ∠G = −180°. Practical minimum: 6 dB (factor of 2).
Phase crossover frequency (ωpc)
The frequency at which the open-loop phase ∠G(jω) = −180°. At this frequency, feedback becomes positive. If the magnitude is ≥ 0 dB here, the system is unstable.
Lead compensator
A compensator C(s) = K(s+zc)/(s+pc) with pc > zc. Adds phase lead in the frequency range [zc, pc], boosting phase margin and increasing bandwidth. The workhorse of classical compensator design.
Notch filter
A filter with a deep magnitude notch at a specific frequency ωn. Used to suppress lightly-damped mechanical resonance peaks in the plant, restoring gain margin at the resonance frequency without broadly reducing bandwidth.
Root locus
A plot of closed-loop pole locations in the complex s-plane as a design parameter (usually loop gain K) varies. Poles in the left half-plane (LHP) → stable; poles in the right half-plane (RHP) → unstable. The gain at which the locus crosses the imaginary axis equals 1/GM.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1FollowBot's arm controller has PM = 18° and GM = 4 dB. A new belt-drive coupling is installed on joint 3 that adds a resonance at 15 rad/s — squarely in the control bandwidth. What failure do you expect and why?›

The resonance adds a sharp magnitude peak near the control bandwidth. Since GM was already only 4 dB (below the 6 dB minimum), a 20–30 dB resonance peak near the phase crossover will push the open-loop magnitude through 0 dB at a frequency where the phase is already near −180°. The system will likely go unstable — the joint will oscillate at or near the resonance frequency. The 18° PM (already below the 30° minimum) means there was little phase budget remaining; additional phase lag from the compliance (real resonances always add phase lag above the resonance) will push PM negative. The fix: add a notch filter at 15 rad/s and/or reduce loop bandwidth below the resonance frequency. The lesson: PM = 18° and GM = 4 dB are not "barely acceptable" — they indicate a controller that will fail on any hardware deviation from the nominal model.

2Why does a lead compensator improve phase margin? Be specific about which frequency range it affects and how it shifts the Bode plots.›

A lead compensator C(s) = K(s + zc)/(s + pc) with pc > zc adds a zero at zc and a pole at pc. A zero adds +20 dB/decade slope and +90° of phase (spread out, appearing as a phase bump starting about a decade before zc and peaking midway between zc and pc). A pole adds −20 dB/decade and −90° of phase. Between zc and pc, the zero's phase contribution dominates — this is the "lead" region where the compensator adds positive phase. If you place this region around the gain crossover frequency ωgc, you boost the phase at exactly the frequency that matters for PM. The pole at pc is needed to make the compensator proper (physically realizable), but it is placed above the crossover so its phase-lag contribution is small at ωgc. The magnitude slope increase from the zero also shifts ωgc to higher frequency — bandwidth increases. This is the tradeoff: more PM comes with more bandwidth, which brings the crossover closer to potential resonances.

3A discrete PID running at 100 Hz has its loop bandwidth designed at 50 rad/s in continuous-time Bode analysis. The PM on the continuous-time Bode plot is 45°. What is the actual PM after discretization, and is this safe?›

A zero-order hold (ZOH) with sample period Ts = 0.01 s adds phase lag of approximately −ω·Ts/2 radians at frequency ω. At ωgc = 50 rad/s: additional lag = −50 × 0.01/2 = −0.25 rad ≈ −14.3°. The actual PM after discretization is approximately 45° − 14° ≈ 31°, which is just barely above the 30° minimum. This is not comfortable — any additional unmodelled delay (computational jitter, actuator lag) will push it below 30°. The rule of thumb ωgc ≤ ωsample/10 exists precisely to keep this discretization penalty small: 100 Hz sampling = 628 rad/s, /10 = 63 rad/s, so a 50 rad/s crossover is close to the limit. Safer would be ωgc = 30 rad/s with this sample rate, giving about −8.6° discretization penalty and 36° remaining PM. Or increase the sample rate to 500 Hz, which reduces the penalty at 50 rad/s to −2.9°.

4What is the difference between gain margin and gain margin as a robustness certificate? Give a concrete scenario where GM = 10 dB is not sufficient robustness for a robot arm.›

Gain margin tells you how much the loop gain magnitude can increase at the phase crossover frequency before the system goes unstable. It is a robustness certificate specifically against gain variation — not against phase variation, resonances, or structural model error. GM = 10 dB means the loop gain can increase by a factor of ~3.16 at ωpc before instability. A concrete case where this is insufficient: a robot arm carrying a variable payload. Maximum payload increases the load inertia by 5×, which reduces the plant's corner frequency and effectively increases the loop gain in the mid-frequency range by a factor exceeding 3 at some frequencies (depending on the plant structure). The arm goes unstable under full load even though your nominal-payload model showed 10 dB GM. The issue: GM is a single-point measure at ωpc; the gain change from payload variation affects a broad frequency range. The Nyquist plot (or structured singular value μ for multivariable systems) gives a more complete robustness picture than Bode margins alone.

Next: feedforward control — reduce what the feedback loop has to reject →