# Measurement Equation

Until now, we’ve dealt with the future. We’ve derived two Kalman Filter prediction equations:

• State Extrapolation Equation
• Covariance Extrapolation Equation

From now on, we are going to deal with the present. We will start from the Measurement Equation.

In the "One-dimensional Kalman Filter" section, we denoted the measurement by $$z_{n}$$.

The measurement value represents a true system state in addition to the random measurement noise $$v_{n}$$, caused by the measurement device.

The measurement noise variance $$r_{n}$$ can be constant for each measurement - for example, if we have scales that have a precision of 0.5kg (standard deviation). On the other hand, the measurement noise variance $$r_{n}$$ can be different for each measurement - for example, if we have a thermometer that has precision of 0.5% (standard deviation). in the latter case, the noise variance depends on the measured temperature.

The generalized measurement equation in matrix form is given by:

$\boldsymbol{z_{n} = Hx_{n} + v_{n}}$
Where:
 $$\boldsymbol{z_{n}}$$ is a measurement vector $$\boldsymbol{x_{n}}$$ is a true system state (hidden state) $$\boldsymbol{v_{n}}$$ is a random noise vector $$\boldsymbol{H}$$ is an observation matrix

## The observation matrix $$\boldsymbol{H}$$

In many cases the measured value is not the desired system state. For example, a digital electric thermometer measures an electric current, while the system state is the temperature. There is a need for a transformation of the system state (input) to the measurement (output).

The purpose of the observation matrix $$\boldsymbol{H}$$ is to convert system state into outputs using linear transformations. The following chapters include examples of the observation matrix usage.

### Scaling

A range meter sends a signal towards a destination and receives a reflected echo. The measurement is the time delay between transmission and reception of the signal. The system state is the range.

In this case we need to perform a scaling:

$\boldsymbol{z_{n}} = \left[ \begin{matrix} \frac{2}{c}\\ \end{matrix} \right] \boldsymbol{x_{n}} + \boldsymbol{v_{n}}$

$\boldsymbol{H} = \left[ \begin{matrix} \frac{2}{c}\\ \end{matrix} \right]$

where:

$$c$$ is the speed of light

Consider

$$\boldsymbol{x_{n}}$$ is the range

$$\boldsymbol{z_{n}}$$ is the measured time delay

### State selection

Sometimes certain states are measured while others are not. For example, the first, third and fifth states of a five-dimensional state vector are measurable, while second and fourth states are not measurable:

$\boldsymbol{z_{n} = Hx_{n} + v_{n}} = \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 1\\ \end{matrix} \right] \left[ \begin{matrix} {x}_{1}\\ {x}_{2}\\ {x}_{3}\\ {x}_{4}\\ {x}_{5}\\ \end{matrix} \right] + \boldsymbol{v_{n}} = \left[ \begin{matrix} {x}_{1}\\ {x}_{3}\\ {x}_{5}\\ \end{matrix} \right] + \boldsymbol{v_{n}}$

### Combination of states

Sometimes some combination of states can be measured instead of each separate state. For example, maybe the lengths of the sides of a triangle are the states, only the total perimeter can be measured:

$\boldsymbol{z_{n} = Hx_{n} + v_{n}} = \left[ \begin{matrix} 1 & 1 & 1 \\ \end{matrix} \right] \left[ \begin{matrix} {x}_{1}\\ {x}_{2}\\ {x}_{3}\\ \end{matrix} \right] + \boldsymbol{v_{n}} = ({x}_{1} + {x}_{2} + {x}_{3}) + \boldsymbol{v_{n}}$

## Measurement equation dimensions

The following table specifies the matrix dimensions of the measurement 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{v}$$ measurement noise vector $$n_{z} \times 1$$