---
title: Feedback and error
heading: The standard feedback loop with a plant, a controller and a sensor, the closed-loop gain G/(1 + GH), how loop gain makes the result depend on the sensor instead of the plant, the steady-state error of proportional control, and the sensitivity function that measures how much a disturbance gets through
eyebrow: D3 · Lesson 2 · Feedback and error
xp: 40
---

::: hook
In 1927 Harold Black was trying to build telephone amplifiers whose gain wouldn't drift with temperature and aging tubes. His solution, sketched on a newspaper on the ferry to work, was to build an amplifier with far more gain than needed and feed a fixed fraction of the output back to subtract from the input. The result had a gain set almost entirely by two resistors, and every op-amp circuit since works the same way. The same arithmetic describes the cruise control of lesson 1, a thermostat and an autopilot: high loop gain makes the output follow the reference and ignore the plant's quirks.
:::

::: play
- A first-order plant (time constant 1 s) under proportional control with loop gain K, stepped from 0 to a reference of 1.
- The output settles to $K/(1 + K)$, leaving a steady error of $1/(1 + K)$, and it gets there with time constant $1/(1 + K)$ s.
- Raising K shrinks the error and speeds the response; for this simple plant nothing goes wrong, but real plants with delays and extra lags oscillate at high gain (lesson 5).
:::

```sim plot
view: graph
x: t = 0..3
y: y = 0..1.1
slider: K = 0.5..100 = 4 log
plot: 1 + 0*t | dashed | color: ch3 | label: reference
plot: K/(1 + K)*(1 - exp(-(1 + K)*t)) | samples: 300 | label: output
readout: steady-state error = 1/(1 + K) | digits: 3
readout: closed-loop time constant, s = 1/(1 + K) | digits: 3
```

::: predict
## An amplifier with open-loop gain 100,000 has a feedback fraction of 0.1. Its open-loop gain then falls by half as it warms up. By how much does the closed-loop gain change?

- [ ] It halves
- [ ] About 10%
- [x] About 0.01%
- [ ] Not at all

::: reveal
The closed-loop gain is $A/(1 + A\beta)$: 9.9990 before and 9.9980 after, a change of 0.01%. A 50% change in A is divided by the loop gain plus one, $1 + A\beta$ = 10,001. The closed-loop gain is almost exactly $1/\beta$ = 10, set by the feedback network.
:::
:::

::: nameit
## The loop

A **plant** G (the thing being controlled) is driven by a **controller** C; a **sensor** H measures the output and the error is $e = r - Hy$. Lumping controller and plant into G, the **closed-loop gain** is

$$T = \frac{y}{r} = \frac{G}{1 + GH}$$

and $L = GH$ is the **loop gain**. When $|L| \gg 1$, $T \approx 1/H$: the output depends on the sensor and hardly at all on the plant.

## Sensitivity

A fractional change in G changes T by

$$\frac{\Delta T}{T} = \frac{1}{1 + L}\cdot\frac{\Delta G}{G}$$

and a disturbance added at the output is also reduced by the **sensitivity** $S = 1/(1 + L)$. Black's amplifier with L = 10,000 cuts a 50% drift in A to 0.005% in T (a little more for a change as large as half, which the linear formula only approximates).

## Steady-state error

With unity feedback (H = 1), a plant of DC gain $G_0$ and a proportional controller of gain $K_p$, a step reference leaves

$$e_{ss} = \frac{1}{1 + K_pG_0}$$

of the step. To make the error vanish, the controller needs integral action (lesson 3).
:::

::: example
## A unity-feedback loop with a plant of DC gain 2 uses a proportional gain of 4.5. What fraction of a step remains as error? What gain would cut it to 1%?

::: solution
1. **Steady-state error.**
   $$\begin{aligned} e_{ss} &= \frac{1}{1 + 4.5 \times 2} \\ &= 1/10 \\ &= 10\% \end{aligned}$$
2. **Gain for 1%.**
   $$1 + 2K_p = 100$$
   so $K_p = 49.5$.

**Answer:** 10% of the step remains as error, and $K_p = 49.5$ cuts it to 1%.
:::
:::

::: example
## Black's amplifier: A = 100,000, β = 0.1. What's the closed-loop gain, and what fraction of an output disturbance gets through?

::: solution
1. **Closed-loop gain.**
   $$\begin{aligned} T &= \frac{100\,000}{1 + 10\,000} \\ &= 9.9990 \end{aligned}$$
2. **Disturbance that gets through.**
   $$\begin{aligned} S &= 1/10\,001 \\ &= 0.01\% \end{aligned}$$
   so a 1 V disturbance at the output appears as 0.1 mV.

**Answer:** the closed-loop gain is 9.9990, and 0.01% of an output disturbance gets through.
:::
:::

::: example
## Black's amplifier ages, and its open-loop gain falls 20%, from 100,000 to 80,000. How much does the closed-loop gain change (β = 0.1)?

::: solution
1. **Gain before.**
   $$100\,000/10\,001 = 9.99900$$
2. **Gain after.**
   $$80\,000/8001 = 9.99875$$
3. **Change.** That's a change of 0.0025%.
4. **Why it's so small.** Feedback divides the plant's variation by about $1 + A\beta$, here ten thousand, which is why amplifiers are built from imprecise transistors.

**Answer:** the closed-loop gain changes by only 0.0025%.
:::
:::

::: check
given: A = 1000 | 10000 | 200000; b = 0.01 | 0.1 | 0.5
answer: A/(1 + A*b)
tolerance: 0.05%

## An amplifier with gain {A} has feedback fraction {b}. What's its closed-loop gain?

::: right
Right. $A/(1 + A\beta)$ = {answer}.
:::

::: misses
- [any] Not yet. $G/(1 + GH)$.
:::
:::

::: check
given: K = 2 | 4 | 9; g = 1 | 2 | 5
answer: 100/(1 + K*g)
tolerance: 0.5%

## A unity-feedback loop has a proportional gain of {K} and a plant of DC gain {g}. What percentage of a step input remains as steady-state error?

::: right
Right. $100/(1 + K_pG_0)$ = {answer}%.
:::

::: misses
- [100/(K*g)] Add one to the loop gain.
- [any] Not yet. $1/(1 + L)$.
:::
:::

::: check
given: L = 4 | 10 | 50; d = 5 | 20 | 50
answer: d/(1 + L)
tolerance: 0.5%

## A plant's gain drifts by {d}%. If the loop gain is {L}, by about what percentage does the closed-loop gain drift?

::: right
Right. $(\Delta G/G)/(1 + L)$ = {answer}%.
:::

::: misses
- [d/L] Divide by 1 + L.
- [any] Not yet. The sensitivity.
:::
:::

::: check
given: e = 1 | 2 | 5; g = 2 | 4 | 10
answer: (100/e - 1)/g
tolerance: 0.5%

## A plant has DC gain {g}. What proportional gain holds the steady-state error to a step at {e}%?

::: right
Right. $K_p = (1/e_{ss} - 1)/G_0$ = {answer}.
:::

::: misses
- [100/e/g] Solve $1/(1 + K_pG_0) = e_{ss}$ exactly.
- [any] Not yet. Rearrange the error formula.
:::
:::

::: check
kind: parts
given: G = 0.5 | 2 | 3; K = 3 | 10 | 40

## A unity-feedback loop has plant DC gain {G} and proportional gain {K}.

::: part
answer: 100/(1 + K*G)
unit: %
tolerance: 0.5%

### What fraction of a step remains as error?

::: misses
- [100/(K*G)] The error is $1/(1 + KG)$.
- [any] $1/(1 + KG)$.
:::
:::

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

### What gain would cut it to 1%?

::: misses
- [any] Solve $1 + KG = 100$.
:::
:::
:::

::: check
kind: parts
given: A = 10000 | 100000; b = 0.01 | 0.1; c = 10 | 50

## An amplifier with open-loop gain {A} and feedback {b} loses {c}% of its open-loop gain with age.

::: part
answer: A/(1 + A*b)
tolerance: 0.01%

### What is the closed-loop gain at first?

::: misses
- [any] $A/(1 + A\beta)$.
:::
:::

::: part
answer: (A/(1 + A*b) - A*(1 - c/100)/(1 + A*(1 - c/100)*b))/(A/(1 + A*b))*100
unit: %
tolerance: 1%

### By what percentage does the closed-loop gain fall?

::: misses
- [c] Feedback shrinks the change by about $1 + A\beta$.
- [any] Compare the two closed-loop gains.
:::
:::
:::

::: explain
## Why does a high loop gain make the closed-loop gain depend on the feedback path instead of the plant?

::: model
The loop works by comparing the measured output with the reference and amplifying the difference. If the gain around the loop is large, even a tiny difference produces a large correction, so the loop settles only where the measured output almost exactly equals the reference. That makes the output equal the reference divided by the sensor's gain, regardless of the plant's gain, which only determines how small the remaining difference is. Changes in the plant therefore show up in the output divided by one plus the loop gain, which is how feedback turns an imprecise, drifting amplifier into a precise one.
:::
:::

::: practice

::: check
given: A = 100 | 1000000; b = 0.001 | 1
answer: A/(1 + A*b)
tolerance: 0.05%

## Closed loop: A = {A}, β = {b}?

::: misses
- [any] $A/(1 + A\beta)$.
:::
:::

::: check
given: K = 0.5 | 500; g = 0.2 | 20
answer: 100/(1 + K*g)
tolerance: 0.5%

## Steady-state error, %: $K_p$ = {K}, $G_0$ = {g}?

::: misses
- [any] $100/(1 + K_pG_0)$.
:::
:::

::: check
given: L = 1 | 10000; d = 1 | 80
answer: d/(1 + L)
tolerance: 0.5%

## Drift through feedback: {d}% with L = {L}?

::: misses
- [any] $d/(1 + L)$.
:::
:::
:::
