---
title: Driven state equations
heading: Inputs, outputs and the full solution of x′ = Ax + Bu
eyebrow: A8 · Lesson 38 · Driven state equations
xp: 40
---

::: hook
Lessons 36 and 37 solved $\dot{\mathbf{x}} = A\mathbf{x}$: a system left alone, settling from wherever it started. Real systems are driven. A source pushes a circuit, a motor's voltage pushes the shaft, and what you measure is some combination of the states. The standard form adds an input and an output, $\dot{\mathbf{x}} = A\mathbf{x} + Bu$ and $y = C\mathbf{x} + Du$, and its solution has two parts: the natural response from the initial state, and a convolution of the input with the matrix exponential from A7.
:::

::: play
- The curve is the state of a series RLC circuit after a 1 V step, plotted as capacitor voltage across and scaled current up, for the damping ratio you set.
- The state spirals into the dot at $(1, 0)$: the steady state, where the capacitor holds the full voltage and no current flows.
- Raise $\zeta$ toward 1. The spiral tightens into a curve that approaches without circling: the overshoot disappears.
:::

```sim plot
view: complex
range: 2
axes: v_C, scaled current
slider: z = 0.05..0.95 step 0.05 = 0.2
curve: (1 - exp(-z*u)*(cos(sqrt(1 - z^2)*u) + z/sqrt(1 - z^2)*sin(sqrt(1 - z^2)*u))) + j*(exp(-z*u)*sin(sqrt(1 - z^2)*u)/sqrt(1 - z^2)) | over: u = 0..40 | label: state after a step
dot: 1 | label: steady state
readout: peak capacitor voltage = 1 + exp(-pi*z/sqrt(1 - z^2)) | digits: 4
```

::: predict
## A stable system $\dot{\mathbf{x}} = A\mathbf{x} + Bu$ gets a constant input $u$. Where does the state end up?

- [ ] At the origin
- [x] At $\mathbf{x} = -A^{-1}Bu$
- [ ] At $\mathbf{x} = Bu$
- [ ] It keeps moving forever

::: reveal
At $-A^{-1}Bu$. Once everything settles, $\dot{\mathbf{x}} = \mathbf 0$, so $A\mathbf{x} + Bu = \mathbf 0$. For a stable system $A$ has no zero eigenvalue, so it's invertible and the steady state is unique. For a series RLC with a DC source, this gives the capacitor at the source voltage and zero current.
:::
:::

::: nameit
## The standard form

$$\dot{\mathbf{x}} = A\mathbf{x} + Bu, \qquad y = C\mathbf{x} + Du$$

$A$ is $n \times n$; $B$ says how the input pushes each state; $C$ says which combination of states you observe; $D$ is any direct path from input to output, often zero.

## The solution

$$\mathbf{x}(t) = e^{At}\mathbf{x}(0) + \int_0^te^{A(t - \tau)}Bu(\tau)\,d\tau$$

The first term is the natural response from the initial state. The second is the forced response, a convolution of the input with $e^{At}B$, the state's response to an impulse. For a constant input on a stable system, it settles to $\mathbf{x}_{ss} = -A^{-1}Bu$.

## The transfer function

Taking Laplace transforms from rest, $s\mathbf{X} = A\mathbf{X} + BU$, so $\mathbf{X} = (sI - A)^{-1}BU$ and

$$H(s) = \frac YU = C(sI - A)^{-1}B + D$$

Its denominator is $\det(sI - A)$, the characteristic polynomial: the poles of the transfer function are the eigenvalues of $A$. Its DC gain, $H(0) = -CA^{-1}B + D$, is the steady-state output per unit of constant input.
:::

::: example
## Find the DC steady state of a series RLC with state $(v_C, i)$ and a source $V$.

::: solution
1. **State equations.** $C\dot v_C = i$ and $L\dot i = V - v_C - Ri$, so
   $$\begin{aligned} A &= \begin{bmatrix}0 & 1/C\\-1/L & -R/L\end{bmatrix} \\ B &= \begin{bmatrix}0\\1/L\end{bmatrix} \end{aligned}$$
2. **Invert $A$.** $\det A = \frac{1}{LC}$, so
   $$A^{-1} = \begin{bmatrix}-RC & -L\\C & 0\end{bmatrix}$$
3. **Steady state.**
   $$-A^{-1}BV = (V, 0)$$
4. **Read it.** The capacitor charges to the source voltage and the current stops, as expected; the formula works the same way for circuits with dozens of states, where intuition runs out.

**Answer:** $v_C = V$ and $i = 0$: the capacitor charges to the source voltage and the current stops.
:::
:::

::: example
## Find the transfer function of $A = \begin{bmatrix}0 & 1\\-2 & -3\end{bmatrix}$, $B = (0, 1)$, $C = \begin{bmatrix}1 & 0\end{bmatrix}$.

::: solution
1. **Form $sI - A$.**
   $$sI - A = \begin{bmatrix}s & -1\\2 & s + 3\end{bmatrix}$$
   with determinant $s^2 + 3s + 2$.
2. **Pick out the entry.** With $B = (0, 1)$ and $C = \begin{bmatrix}1 & 0\end{bmatrix}$, $H$ is the top-right entry of $(sI - A)^{-1}$ (swap the diagonal, negate the off-diagonal, divide by the determinant):
   $$H(s) = \frac{1}{s^2 + 3s + 2}$$
3. **Check against the equation.** That's $\ddot y + 3\dot y + 2y = u$, the equation this state form came from.
4. **DC gain.** $H(0) = 0.5$.

**Answer:** $H(s) = \frac{1}{s^2 + 3s + 2}$, with a DC gain of 0.5.
:::
:::

::: example
## Two RC stages with $\tau$ = 1 s are separated by a buffer, so $\dot x_1 = -x_1 + u$ and $\dot x_2 = -x_2 + x_1$. Find $x_2$ after a unit step.

::: solution
1. **Eigenvalues.** $A = \begin{bmatrix}-1 & 0\\1 & -1\end{bmatrix}$ has the eigenvalue $-1$ twice with one eigenvector, so expect $te^{-t}$.
2. **First stage.** Solving in order,
   $$x_1 = 1 - e^{-t}$$
3. **Second stage.** Then $\dot x_2 + x_2 = 1 - e^{-t}$ gives
   $$x_2 = 1 - e^{-t} - te^{-t}$$
4. **At $t = 1$.**
   $$\begin{aligned} x_2(1) &= 1 - \frac2e \\ &= 0.264 \end{aligned}$$
5. **The slow start.** The second stage starts slowly, since its input starts at zero: its response begins flat, like $\frac{t^2}{2}$.

**Answer:** $x_2 = 1 - e^{-t} - te^{-t}$, which is 0.264 at $t = 1$ s.
:::
:::

::: check
given: a = 1 | 2; b = 2 | 4
answer: 1/(a*b)
tolerance: 0.5%

## $\dot x_1 = -\given{a}x_1 + u$ and $\dot x_2 = -\given{b}x_2 + x_1$, with output $y = x_2$. What is the DC gain?

::: right
Right. In steady state $x_1 = u/a$ and $x_2 = x_1/b$, so the gain is {answer}.
:::

::: misses
- [1/a] That's $x_1$'s steady state; the second stage divides by $b$ too.
- [any] Not yet. Set both derivatives to zero.
:::
:::

::: check
given: k = 10 | 40; m = 1 | 2
answer: 1/k
unit: m/N
tolerance: 0.5%

## A mass of {m} kg on a spring of {k} N/m with damping is pushed by a constant force. How far does it move per newton, in steady state?

::: right
Right. $H(0) = 1/k$ = {answer}: in steady state only the spring holds the force.
:::

::: misses
- [1/m] The mass matters for the dynamics but not for the final position.
- [any] Not yet. Set the derivatives to zero: $kx = F$.
:::
:::

::: check
given: a = 0.5 | 2; u = 3 | 5; t = 1 | 2
answer: u/a*(1 - exp(-a*t))
tolerance: 0.5%

## Solve $\dot x = -\given{a}x + \given{u}$ from rest. What is $x$ at $t$ = {t}?

::: right
Right. $\frac ua(1 - e^{-at})$ = {answer}.
:::

::: misses
- [u*(1 - exp(-a*t))] The steady state is $u/a$.
- [any] Not yet. $x = \int_0^te^{-a(t - \tau)}u\,d\tau$.
:::
:::

::: check
given: t = 0.5 | 1 | 3
answer: 1 - exp(-t) - t*exp(-t)
tolerance: 0.5%

## For the two buffered RC stages ($\tau$ = 1 s), what is $x_2$ at $t$ = {t} after a unit step?

::: right
Right. $1 - e^{-t} - te^{-t}$ = {answer}.
:::

::: misses
- [1 - exp(-t)] That's the first stage.
- [any] Not yet. Feed $x_1 = 1 - e^{-t}$ into the second stage.
:::
:::

::: check
kind: parts
given: c = 2 | 3 | 4; k = 2 | 5

## $A = \begin{bmatrix}0 & 1\\-\given{k} & -\given{c}\end{bmatrix}$, $B = (0, 1)$, $C = \begin{bmatrix}1 & 0\end{bmatrix}$.

::: part
answer: c
tolerance: 0.5%

### $H(s) = \frac{1}{s^2 + ps + q}$. What is $p$?

::: misses
- [-c] $\det(sI - A) = s^2 + cs + k$.
- [any] Expand $\det(sI - A)$.
:::
:::

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

### What is the DC gain?

::: misses
- [any] $H(0) = 1/k$.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..4, b = 0.5..3, t = 0..4

## Solve $\dot x = -ax + bu$ from rest with $u$ a unit step, using $x = \int_0^te^{-a(t - \tau)}b\,d\tau$.

::: step
answer: b/a*(1 - exp(-a*t))

### What is $x(t)$?
:::

::: step
answer: b/a

### What does it settle to?
:::

::: right
Right. The steady state is $-A^{-1}Bu = \frac ba$, the same as setting $\dot x = 0$.
:::
:::

::: explain
## Why are the poles of a system's transfer function the eigenvalues of its state matrix?

::: model
The transfer function is $C(sI - A)^{-1}B + D$, and the inverse of $sI - A$ is its adjugate divided by its determinant, $\det(sI - A)$. So every entry has $\det(sI - A)$ in the denominator, and that polynomial is zero exactly when $s$ is an eigenvalue of $A$. Those are the values of $s$ where the transfer function can blow up: its poles. Physically, both describe the natural modes, the exponentials $e^{\lambda t}$ the system produces by itself. A mode can be hidden if $B$ never excites it or $C$ never sees it, in which case its pole cancels from $H(s)$, but it's still in $A$.
:::
:::

::: practice

::: check
given: a = 0.1..10; b = 0.1..10
answer: 1/(a*b)
tolerance: 0.5%

## DC gain of two first-order stages with rates {a} and {b}?

::: misses
- [any] $\frac{1}{ab}$.
:::
:::

::: check
given: a = 0.1..5; u = 0.5..10; t = 0..5
answer: u/a*(1 - exp(-a*t))
tolerance: 0.5%

## $x(t)$ for $\dot x = -\given{a}x + \given{u}$ from rest, at $t$ = {t}?

::: misses
- [any] $\frac ua(1 - e^{-at})$.
:::
:::
:::
