# 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 have 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 scales with precision of 0.5kg (standard deviation). On the other side, the measurement noise variance $$r_{n}$$ can be different for each measurement, for example a thermometer with precision of 0.5% (standard deviation), in this case the noise variance depends on the measured temperature.

The generalized measurement equation in a 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}}$$ 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, the digital electric thermometer measures the 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 the signal towards the destination and receives the 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 a speed of light

Consider

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

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

### State selection

Sometimes certain states are measured, when 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

Length of the triangle sides are states, but a 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$$