# State Update Equation

This page is going to be the shortest page of this tutorial. I've provided extensive description of the State Update Equation in the "$$\alpha -\beta -\gamma$$ filter" section and "One-dimensional Kalman Filter section".

The State Update Equation in the matrix form is given by:

$\boldsymbol{\hat{x}_{n,n} = \hat{x}_{n,n-1} + K_{n} ( z_{n} - H \hat{x}_{n,n-1} )}$
where:
 $$\boldsymbol{\hat{x}_{n,n}}$$ is a estimated system state vector at time step $$n$$ $$\boldsymbol{\hat{x}_{n,n-1}}$$ is a predicted system state vector at time step $$n - 1$$ $$\boldsymbol{K_{n}}$$ is a Kalman Gain $$\boldsymbol{z_{n}}$$ is a measurement $$\boldsymbol{H}$$ is an observation matrix

You should be familiar with all components of the State Update Equation except the Kalman Gain in a matrix notation. We will derive the Kalman Gain a little bit later.

You should pay attention on the dimensions. If, for instance, the state vector has 5 dimensions, while only 3 dimensions are measurable (the first, third and fifth states):

$\boldsymbol{x(n)} = \left[ \begin{matrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\\ x_{5}\\ \end{matrix} \right] \boldsymbol{z(n)} = \left[ \begin{matrix} z_{1}\\ z_{3}\\ z_{5}\\ \end{matrix} \right]$

The observation matrix would be $$3 \times 5$$ matrix:

$\boldsymbol{H} = \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 1\\ \end{matrix} \right]$

The innovation $$\left( \boldsymbol{ z_{n} - H \hat{x}_{n,n-1}} \right)$$ yields:

$\left( \boldsymbol{ z_{n} - H \hat{x}_{n,n-1}} \right) = \left[ \begin{matrix} z_{1}\\ z_{3}\\ z_{5}\\ \end{matrix} \right] - \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 1\\ \end{matrix} \right] \left[ \begin{matrix} \hat{x}_{1}\\ \hat{x}_{2}\\ \hat{x}_{3}\\ \hat{x}_{4}\\ \hat{x}_{5}\\ \end{matrix} \right] = \left[ \begin{matrix} (z_{1} - \hat{x}_{1})\\ (z_{3} - \hat{x}_{3})\\ (z_{5} - \hat{x}_{5})\\ \end{matrix} \right]$

The Kalman Gain dimensions shall be $$5 \times 3$$.

## State Update Equation dimensions

The following table specifies the matrix dimensions of the State Update Equation variables:

Variable Description Dimension
$$\boldsymbol{x}$$ state vector $$n_{x} \times 1$$
$$\boldsymbol{z}$$ output vector $$n_{z} \times 1$$
$$\boldsymbol{H}$$ observation matrix $$n_{z} \times n_{x}$$
$$\boldsymbol{K}$$ Kalman gain $$n_{x} \times n_{z}$$