# Minimal state vector for a Kalman filter

I'm trying to work my way through a text on robotics and specifically trying to make sense of Kalman filters. I've used them before but I'd like to be able to understand and make my own for new systems.

The question I have asks for the minimal state vector for a car with position X and velocity V at time t. The acceleration (A) is assigned randomly at each point in time. I have to come up with a minimal state vector so the the resulting system is Markovian.

The initial state vector should just be S = [X,V,A] since those are the three components that were given? The Markovian part is confusing to me. This means that the state vector can only have components that do not depend on past measurements? In which case it should only be S = [X,A] since acceleration was given to be random and position has no time dependence?

• Why wouldn't position change as a function of time? It does. – Michael R. Chernick Aug 29 '12 at 2:28

I use Kalman Filters frequently, although my theoretical grounding in this area is not extensive. I am unsure of the exact meaning of the terminology 'minimal state vector'. However, in this situation the state vector to use would be S = [X,V].

The update step will project the position X by assuming a constant velocity V for the length of the timestep t. This makes the update matrix (the A matrix in the terminology of Welch & Bishop) $$\left[\begin{array}{cc} 1 & t \\ 0 & 1 \\ \end{array}\right]$$

If the acceleration is random each step but known (i.e. can be measure independently in real time), then this becomes the driving term in the update equation. In the more common case that it is random and unknown, then it forms the process noise. The art of applying the Kalman Filter then becomes tweaking the process noise term to match the magnitude of the acceleration expected.

• There has to be a better way of formatting the matrix... Any ideas? – Bogdanovist Aug 29 '12 at 2:43
• Thanks, The acceleration being random was confusing to me. That makes sense that it can be random but known. I still have a lot of reading to do on this. – JDD Aug 29 '12 at 2:48
• @Bogdanovist You can just use latex markup. I think what you're looking for is $$\left[\begin{array}{cc} 1 & t \\ 0 & 1 \\ \end{array}\right]$$ which isi $$\left[\begin{array}{cc} 1 & t \\ 0 & 1 \\ \end{array}\right]$$ – conjugateprior Aug 29 '12 at 7:07

First of all, start with the motion model of your system. For the problem stated in the book,

we have (i.e. $\Delta t = 1 )$

\begin{align} \begin{bmatrix} x_{t} \\ \dot{x}_{t} \end{bmatrix} = \underbrace{ \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} }_{A} \begin{bmatrix} x_{t-1} \\ \dot{x}_{t-1} \end{bmatrix} + \underbrace{ \begin{bmatrix} \frac{1}{2} \\ 1 \end{bmatrix} }_{B} u_{t} \end{align}

where $\ddot{x} \equiv u \sim \mathcal{N}(0,1)$

a) I think the minimal state vector is the dimension of the state vector hence 2. (I'm not really sure about what they mean by minimal ).

b) I think by asking you to "design the state transition probability $p(x_{t} | u_{t}, x_{t-1})$" is to determine explicitly $A, B$ and $R$.

c) This is Matlab Code

clear all
clc
A = [1 1;
0 1];
B = [0.5;
1];
P = diag([0,0]);
X = [0; 0];
% Compute the first case (i.e. t = 0 )
u = 0;
R = 1;
X = A*X + B*u;
P = A*P*A' + R;

% Compute the rest (i.e. t = 1:5 )
for t = 1:5
u = randn(); % randn() -> N(0,1)
X = A*X + B*u;
P = A*P*A' + R;
end


As you can see, the source of the process noise is coming from the input (i.e. the acceleration). This is not always the case. Sometimes the input is ideal (in simulation cases) and the process noise is coming from an external source.