Skip to content
Tactiverge

School/✦ Research Engineer/Week 14

State-space form: x[k+1] = A·x[k] + B·u[k] + w[k]

To predict where a lander will be in one second, what is the smallest set of numbers you need to know right now?

About 40 min · 3 goals · Checked by automated tests

1.Why should I care?

Every estimator from here on needs a model of how the state moves between measurements. State-space form is the shared language: the same A and B matrices describe a rover, a lander or a satellite, and the noise term w is where the filter's Q will come from.

  • ◇ Define the state of a system as the minimal information that predicts its future.
  • ◇ Write a sampled model in the form x[k+1] = A·x[k] + B·u[k] + w[k].
  • ◇ Form a closed-loop matrix A − BK and judge discrete stability from eigenvalues.

2.Discover

In the Code Lab, write A = [[1, Δt], [0, 1]] and B = [Δt²/2, Δt] for Δt = 0.5 s. Step a lander from p = 2 m, v = 1 m/s for 10 steps with u = 0.4 m/s², then add process noise w with σ = 0.05 on each state and run it 5 times. Plot the spread of final positions.

Can't use the interactive? Read a description instead

The Code Lab activity is a matrix-stepping exercise that can be done on paper: ten steps of p ← p + 0.5v + 0.125u, v ← v + 0.5u, starting at p = 2, v = 1, u = 0.4.

3.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

A lander's state is x = [position; velocity] with x_{k+1} = A·x_k + B·u_k, A = [[1, Δt], [0, 1]], B = [Δt²/2; Δt], Δt = 0.5 s. Now position = 0 m, velocity = 1 m/s and thrust acceleration u = 1 m/s². What is the next position, in m?

m

4.Apply it

Add a third state, a constant accelerometer bias b, so the true acceleration is u − b. Write the new 3 × 3 A and the 3 × 1 B. Which state can no sensor that measures position alone ever see directly, and how could a filter still estimate it?

5.Understand

What is a state?

The state x[k] is a vector holding just enough to predict the future given the inputs: for a moving body, position and velocity; for a heater, temperature. Inputs u[k] are what we command (thrust, wheel speed). Outputs y[k] = C·x[k] + v[k] are what sensors see, with measurement noise v.

The sampled model

x[k+1] = A·x[k] + B·u[k] + w[k]. A says how the state evolves on its own, B how inputs push it, and w is process noise: unmodelled disturbances such as wheel slip or a gust. For constant-acceleration motion over Δt, A = [[1, Δt], [0, 1]], B = [Δt²/2, Δt]ᵀ.

Closed loop and stability

With state feedback u = −K·x, the loop becomes x[k+1] = (A − BK)·x[k]. A discrete-time linear system is stable when every eigenvalue λ of its matrix has |λ| < 1: each step multiplies the modes by λ, so they shrink. |λ| = 1 is marginal, |λ| > 1 grows without bound.

Explain it another way

The state is the system's memory. Knowing where the lander is and how fast it is going, you can roll the clock forward one tick at a time, nudging it with each command.

Worked example 1

x = [p; v] = [10; −2], Δt = 1 s, u = 0.5 m/s². Find x[k+1].

p = 10 − 2 + 0.25 = 8.25 m; v = −2 + 0.5 = −1.5 m/s.

Worked example 2

Is x[k+1] = [[1.1, 0], [0, 0.5]]·x[k] stable?

Eigenvalues 1.1 and 0.5. |1.1| > 1, so one mode grows 10% per step: unstable.

Common mix-ups

  • The state is everything you can measure.
    ✓ The state is what you need to predict the future. Some of it (velocity, sensor bias) may never be measured directly.
  • Discrete systems are stable when eigenvalues are negative.
    ✓ That is the continuous-time rule. In discrete time the test is |λ| < 1.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

Which discrete-time matrix is stable?

Practice 3

With A = [[1, Δt], [0, 1]], B = [Δt²/2; Δt], Δt = 0.2 s, v = 3 m/s and u = −5 m/s², what is the next velocity, in m/s?

m/s

Practice 4

In x[k+1] = A·x[k] + B·u[k] + w[k], what does w represent for a rover?

7.Predict

A lander at position 2 m, velocity 1 m/s, thrust acceleration 0.4 m/s², time step 0.5 s. Next position?

Guess first. Being wrong here is how the surprise works.

8.Reflect

Concepts: States and state-space models · Matrices and linear transformations