---
title: Robustness and model uncertainty
heading: How wrong a model may be: multiplicative uncertainty, the small-gain theorem and the robust stability test |WT| < 1, gain and delay uncertainty, and robust performance
eyebrow: S9 · Lesson 29 · Robustness and model uncertainty
xp: 50
---

::: hook
Every controller is designed for a model, and every model is wrong: gains drift with temperature, resonances hide above the frequencies anyone measured, delays change with load. Gain and phase margins (lesson 25) guard against two particular kinds of error, one at a time. Robust control asks the general question: given a bound on how far the real plant may differ from the model at each frequency, is the loop guaranteed to stay stable, and to keep performing? The answer comes from a single inequality on the complementary sensitivity.
:::

::: play
- The solid curve is $20\log|T|$ for a closed loop $\omega_n^2/(s^2 + 2\zeta\omega_ns + \omega_n^2)$ with ζ = 0.5; the dashed curve is $-20\log|W|$, the inverse of an uncertainty weight that's 10% at low frequency and grows past 100% above 10 rad/s, $W = 0.1(s + 1)/(s/20 + 1)$.
- The loop is guaranteed stable for every plant in the set as long as the solid curve stays below the dashed one at every frequency.
- Raise $\omega_n$ and T's peak climbs into the region where the model is poor: fast loops need good models at high frequencies.
:::

```sim plot
view: graph
x: w = 0.1..1000 log
y: M = -60..20 dB
slider: n = 1..40 = 5
plot: 20*log(n^2/sqrt((n^2 - w^2)^2 + (n*w)^2)) | label: |T|, ζ = 0.5
plot: -20*log(0.1*sqrt(1 + w^2)/sqrt(1 + (w/20)^2)) | dashed | label: 1/|W|
```

::: predict
## A loop's closed-loop gain T peaks at 1.5. The real plant's gain may differ from the model's by an unknown factor at every frequency. How large may that relative error be with stability guaranteed?

- [ ] 150%
- [ ] Any size, if the phase margin is large
- [x] Up to 1/1.5, about 67%
- [ ] 15%

::: reveal
A multiplicative error Δ turns the loop gain into $L(1 + \Delta)$, and the closed loop stays stable for every such error if $|\Delta T| < 1$ at all frequencies: here $|\Delta| < 1/1.5 = 0.67$. That's the small-gain theorem at work. The bound allows any phase for the error, so it's a guarantee, not a prediction: particular errors much larger may still be stable.
:::
:::

::: nameit
## Describing uncertainty

A **multiplicative** (relative) uncertainty set contains every plant
$$P_\text{true} = P(1 + W\Delta), \qquad |\Delta(j\omega)| \le 1$$
where the weight W says how large the relative error may be at each frequency: small at low frequency where the model was measured, near or above 1 where it's unknown. Typical sources:
- a gain known only within ±r: |W| = r;
- an unmodeled delay of up to θ: $|W| = |e^{-j\omega\theta} - 1| = 2|\sin(\omega\theta/2)| \le \omega\theta$;
- neglected fast poles and resonances: |W| rising with frequency.

## The small-gain theorem and robust stability

A feedback loop of two stable systems is stable if the product of their peak gains is below one. Applied to the uncertainty seen through the nominal loop, the closed loop is stable for every plant in the set exactly when
$$|W(j\omega)T(j\omega)| < 1 \quad \text{for all } \omega$$
so |T| must stay under $1/|W|$. Since T ≈ 1 below crossover, the model must be good there (|W| < 1); above crossover T rolls off and the model may be poor.

## Robust performance

Performance is usually a bound on the sensitivity, $|W_pS| < 1$, with a weight $W_p$ large where disturbances must be rejected. Keeping it for every plant in the set needs
$$|W_pS| + |WT| < 1 \quad \text{for all } \omega$$
which is harder than nominal performance and robust stability separately, most of all near crossover, where both S and T are near one.
:::

::: example
## A loop has nominal $T = 1/(s + 1)$ (from $L = 1/s$). What unmodeled delay does the small-gain test guarantee it can tolerate, and what's the exact limit?

::: solution
1. **The small-gain test.** With $|W| = 2|\sin(\omega\theta/2)|$, it needs
   $$\frac{2|\sin(\omega\theta/2)|}{\sqrt{1 + \omega^2}} < 1$$
   at every ω.
2. **Search for the limit.** A numerical search finds it holds up to θ = 1.48 s; at θ = 1 s the peak of $|WT|$ is 0.76.
3. **The exact limit.** It's the delay margin:
   $$\begin{aligned} \text{PM}/\omega_c &= (\pi/2)/1 \\ &= 1.57\ \text{s} \end{aligned}$$
4. **Compare.** The test is only 6% conservative here, because a delay's error really can take any phase as frequency varies.

**Answer:** the small-gain test guarantees 1.48 s of delay, and the exact limit is 1.57 s.
:::
:::

::: example
## A loop has a 9.5 dB gain margin (a factor of 3). The plant's gain is known only within ±50%. What margin survives the worst case, and what does the robust stability test say?

::: solution
1. **Worst-case gain margin.** At 1.5 times the nominal gain:
   $$\begin{aligned} \text{GM} &= 3/1.5 \\ &= 2 \end{aligned}$$
   or 6.0 dB: still stable.
2. **Robust stability test.** At all frequencies it asks for a peak closed-loop gain below 2:
   $$\begin{aligned} |T| &< 1/0.5 \\ &= 2 \end{aligned}$$
3. **How the two compare.** The test covers gain errors of any phase as well as real ones, so it is stricter than checking the gain margin, but it also covers the plant's gain drifting differently at different frequencies.

**Answer:** a gain margin of 2 (6.0 dB) survives, and the robust stability test asks for $|T| < 2$ at every frequency.
:::
:::

::: example
## At 0.5 rad/s, the loop $L = 10/(s(s + 1))$ must keep |S| below 0.1 (so $|W_p|$ = 10) while the model may be off by 30% (|W| = 0.3). Is robust performance met at that frequency?

::: solution
1. **Sensitivities at 0.5 rad/s.**
   $$|S| = 0.057, \quad |T| = 1.02$$
2. **Robust performance test.**
   $$\begin{aligned} &|W_pS| + |WT| \\ &= 0.573 + 0.307 \\ &= 0.880 < 1 \end{aligned}$$
   so it's met.
3. **Where the room went.** Nominal performance alone looks comfortable at 0.57, but the uncertainty uses up most of the remaining room.
4. **Larger errors.** A model error above 42% there would break the guarantee even though the nominal loop meets its specification.

**Answer:** yes: $|W_pS| + |WT|$ = 0.880, below 1, though a model error above 42% would break it.
:::
:::

::: check
kind: parts
given: M = 1.1 | 1.3 | 1.6 | 2.5

## A closed loop's |T| peaks at {M}.

::: part
answer: 100/M
unit: %
tolerance: 0.5%

### Up to what relative model error, of any phase, is stability guaranteed?

::: misses
- [100*(M - 1)] The test is $|W| < 1/|T|$.
- [any] $1/M_t$.
:::
:::
:::

::: check
kind: parts
given: h = 10 | 20 | 40; w = 50 | 100 | 200

## A loop may contain an unmodeled delay of up to {h} ms.

::: part
answer: 2*abs(sin(w*h*1e-3/2))
tolerance: 0.5%

### How large is the relative uncertainty $|e^{-j\omega\theta} - 1|$ at {w} rad/s?

::: misses
- [w*h*1e-3] That's the small-angle bound; use $2|\sin(\omega\theta/2)|$.
- [any] $2|\sin(\omega\theta/2)|$.
:::
:::

::: part
answer: 1/(2*abs(sin(w*h*1e-3/2)))
tolerance: 0.5%

### What's the largest |T| allowed at that frequency?

::: misses
- [any] $1/|W|$.
:::
:::
:::

::: check
kind: parts
given: G = 2 | 3 | 6; r = 20 | 50 | 80

## A loop has a gain margin of {G} (a factor) and the plant's gain may be up to {r}% higher than modeled.

::: part
answer: G/(1 + r/100)
tolerance: 0.5%

### What gain margin remains in the worst case?

::: misses
- [G - r/100] Gains multiply.
- [any] Divide by $1 + r$.
:::
:::

::: part
answer: 20*log(G/(1 + r/100))
unit: dB
tolerance: 1%

### In decibels?

::: misses
- [any] $20\log_{10}$ of the factor.
:::
:::
:::

::: check
kind: parts
given: S = 0.05 | 0.2 | 0.5; T = 0.9 | 1.1 | 1.3; p = 2 | 4 | 10; u = 0.1 | 0.3 | 0.5

## At one frequency a loop has |S| = {S} and |T| = {T}; the performance weight is $|W_p|$ = {p} and the uncertainty weight |W| = {u}.

::: part
answer: p*S + u*T
tolerance: 0.5%

### What is $|W_pS| + |WT|$ there (robust performance needs it below 1)?

::: misses
- [p*S] That's nominal performance only.
- [any] Add the two weighted terms.
:::
:::
:::

::: check
kind: parts
given: a = 0.5 | 2 | 4; b = 0.1 | 0.3 | 0.45

## Two stable systems in a feedback loop have peak gains {a} and {b}.

::: part
answer: a*b
tolerance: 0.5%

### What is the product the small-gain theorem tests?

::: misses
- [any] Multiply the peak gains.
:::
:::

::: part
answer: 1/a
tolerance: 0.5%

### How large could the second system's peak gain be, with the first unchanged, and stability still guaranteed?

::: misses
- [any] The product must stay below 1.
:::
:::
:::

::: check
kind: parts
given: c = 0.5 | 2 | 4; h = 0.1 | 0.3 | 0.6

## A loop $L = e^{-s\theta}/(\tau_cs)$ was designed for θ = 0 with $\tau_c$ = {c} s; the actual delay is {h} s.

::: part
answer: (pi/2 - h/c)*180/pi
unit: °
tolerance: 0.5%

### What phase margin does it have?

::: misses
- [90 - h*180/pi] The crossover is at $1/\tau_c$, so the delay costs $\theta/\tau_c$ radians.
- [any] $90° - \theta/\tau_c$ in radians converted.
:::
:::

::: part
answer: pi/2*c
unit: s
tolerance: 0.5%

### What's the largest delay it could tolerate?

::: misses
- [any] The delay margin: $(\pi/2)\tau_c$.
:::
:::
:::

::: check
kind: choice

## Why must a model be accurate near and below the crossover frequency but may be poor far above it?

- [ ] High frequencies don't matter to stability
- [x] Robust stability needs $|W| < 1/|T|$; below crossover |T| ≈ 1, so the relative error must stay well below one, while far above crossover |T| is small and large errors are tolerated
- [ ] Controllers ignore high frequencies
- [ ] Models are always accurate at high frequency

::: misses
- [1] Unmodeled resonances above crossover do matter if |T| isn't small there.
- [3] They don't; T is what filters them.
- [4] Usually the opposite: fast dynamics are the least known.
:::
:::

::: check
kind: derivation
vars: t = 0.001..1, w = 0.01..100, M = 1..3, r = 0.01..0.9

## A loop with |T| = M at frequency w faces a delay uncertainty of up to t seconds, or separately a gain uncertainty of ±r.

::: step
answer: 2*abs(sin(w*t/2))

### What is the delay's |W| at w?
:::

::: step
answer: M*2*abs(sin(w*t/2))

### What is |WT| for the delay at w?
:::

::: step
answer: M*r

### And |WT| for the gain uncertainty?
:::

::: right
Right. Every source of uncertainty becomes a weight, and the test is the same for all of them.
:::
:::

::: check
kind: python

## Write `peak_wt(L, W, ws)`: the largest $|W(j\omega)T(j\omega)|$ over the list of frequencies ws, with L and W given as Python functions of the complex s; and `max_delay(L, wmin, wmax)`: the largest θ (by bisection between 0 and 10) for which the small-gain test with $|W| = 2|\sin(\omega\theta/2)|$ passes on 4000 log-spaced frequencies from wmin to wmax.

```python starter
def peak_wt(L, W, ws):
    return 0.0

def max_delay(L, wmin, wmax):
    return 10.0
```

```python solution
import cmath, math

def peak_wt(L, W, ws):
    best = 0.0
    for w in ws:
        s = 1j * w
        T = L(s) / (1 + L(s))
        best = max(best, abs(W(s) * T))
    return best

def max_delay(L, wmin, wmax):
    ws = [wmin * (wmax / wmin) ** (k / 3999) for k in range(4000)]
    lo, hi = 0.0, 10.0
    for _ in range(50):
        th = (lo + hi) / 2
        W = lambda s, th=th: cmath.exp(-s * th) - 1
        if peak_wt(L, W, ws) < 1:
            lo = th
        else:
            hi = th
    return lo
```

```python tests
import math
L = lambda s: 1 / s
ws = [10 ** (-3 + 6 * k / 9999) for k in range(10000)]
assert abs(peak_wt(L, lambda s: 0.5, ws) - 0.5) < 1e-3, "T = 1/(s + 1) peaks at 1: a 50% gain error gives 0.5."
assert abs(max_delay(L, 1e-3, 1e3) - 1.477) < 0.01, "The small-gain test allows about 1.48 s, against the true 1.57 s."
```

::: right
Right. The small-gain test needs only magnitudes, so it covers every phase the error might have, which is where its conservatism comes from.
:::
:::

::: explain
## How does the robust stability condition |WT| < 1 connect to gain and phase margins?

::: model
Gain and phase margins each test one kind of model error at one frequency: a real change in gain at the phase crossover, or a pure phase shift at the gain crossover. The condition |WT| < 1 tests every error whose size is bounded by |W| at each frequency, whatever its phase, which includes both of those as special cases and also errors that combine gain and phase, or that vary with frequency like unmodeled resonances and delays. It follows from the small-gain theorem: the error closes a loop through T, and if the gain around that loop stays below one, no instability can build up. The cost is conservatism, since it guards against error phases the real plant may never have.
:::
:::

::: practice
::: check
given: M = 1.1 | 1.2 | 1.3 | 1.5 | 2 | 2.5
answer: 100/M
unit: %
tolerance: 0.5%

## Relative error tolerated when |T| peaks at {M}?

::: misses
- [any] $1/M_t$.
:::
:::

::: check
given: h = 2 | 10; w = 20 | 80
answer: 2*abs(sin(w*h*1e-3/2))
tolerance: 0.5%

## |W| of a {h} ms delay at {w} rad/s?

::: misses
- [any] $2|\sin(\omega\theta/2)|$.
:::
:::

::: check
given: G = 2.5 | 4; r = 30 | 60
answer: G/(1 + r/100)
tolerance: 0.5%

## Worst-case gain margin: {G}, gain up to {r}% high?

::: misses
- [any] Divide by $1 + r$.
:::
:::
:::
