- The state is the smallest set of numbers you need now to predict what happens next.
- The transition matrix F steps the state forward by one tick of Δt.
- The input matrix B turns a known push u (a motor command) into its effect on the state.
- The measurement matrix H picks out the parts of the state a sensor can see.
- The same equations work for 2 numbers or 2 million: only the matrix sizes change.
What is the state?
Two robots stand at the same spot on a line. One is parked, the other drives at 3 m/s. One second later they are 3 m apart. Knowing the position alone was not enough to predict the future. You also need the velocity.
The state is the smallest set of numbers you need right now to predict what happens next, given the rules of motion and the inputs you apply. For the robot on a line it is two numbers: x = (position, velocity).
How many numbers depends on what you track. A drone in 3D needs position and velocity in x, y and z: 6 numbers. Add its three tilt angles and their rates and you have 12. A weather model tracks temperature, pressure and wind at every grid point: millions of numbers. The Kalman filter equations do not care. The matrices get bigger, the structure stays the same.
The discrete model
A computer updates in ticks. Δt (read "delta t") is the length of one tick in seconds. We write the motion one tick at a time:
The small k counts the ticks: xₖ is the state at tick k, xₖ₊₁ one tick later. F is the transition matrix: the rules of motion for one tick. u is a known input, like a motor command, and B says how it changes the state. A second equation says what a sensor can read:
H is the measurement matrix. It selects the parts of the state the sensor can see.
A moving mass: F
No friction, no push. In one tick the position grows by velocity times Δt, and the velocity stays the same:
Row 1 says p + v·Δt. Row 2 says v. That one matrix holds the physical fact "position changes by velocity times time". In lesson 2 the encoder handed us the distance moved, u, and we wrote x⁻ = x + u. Here the filter works out that distance itself, from the velocity it is tracking.
Friction (in F) and a motor push (B)
Friction slows the robot in proportion to its speed. Write its strength as one number, the friction rate c, in units of 1 per second. (Treat c as a given number for the robot.) Each tick, friction removes the fraction c·Δt of the velocity, so the velocity row becomes 1 − cΔt.
A motor gives a known acceleration u, which adds u·Δt to the velocity. Here u is an acceleration, not a distance (in lesson 2 it was a distance). Only the velocity row changes:
With friction and a steady push, the robot speeds up or slows down until the two balance. The velocity stops changing when the friction loss equals the push:
Keep reading with the full course
Finish lesson 3 and you will be able to: track position and velocity in 2D with the matrix Kalman filter.
Still locked here:
- The rest of this explanation
- 3 more examples with step-by-step solutions
- Five extra members-only problems with worked solutions
$20 once, lifetime access. Lessons 1 and 2 stay free.
Examples
Example 1 · Coasting
Δt = 1 s, start at x = (0, 3): position 0 m, velocity 3 m/s, no friction.
Show solutionHide solution
Constant velocity, position up by 3 m every second. GPS would read z = H x = 3, then 6.
Example 2 · Friction
Δt = 0.1 s, c = 0.5 per second, start at (0, 3), no push. The velocity row is 1 − 0.5·0.1 = 0.95.
Show solutionHide solution
The velocity shrinks by 5% each tick, and the position grows a little less each time. Left alone, the robot coasts to a stop.

Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.