# Kalman Filter with multiple inputs

Let's say I have one laser scanner and a radar device, which I should use to measure a distance to a wall (Fig. 1). Both devices are place on the same support, so... they should measure the same distance (+/- the tolerances of the single device). It is an ideal scenary, so both devices are measuring the distance perfect perpendicular to the wall. Both tolerances of the devices are taken from the datasheet of the device. So the values of $$\delta r_{1}$$ and $$\delta r_{2}$$ are known. We consider the case, where those values are normal distributed. Now... I need to fuse both measures to one value using a Kalman filter. Reading here and here I can imagine two way to achieve this goal:

1. From both values and measures I calculate the mean value and the new variance by simply computing: $$\mu_{new} = \frac{\mu_{1}\delta r_{2}^{2} + \mu_{2}\delta r_{1}^{2}}{\delta r_{1}^{2} + \delta r_{2}^{2}}$$ and $$\delta_{new} = \frac{1}{\frac{1}{\delta r_{1}^{2}} + \frac{1}{\delta r_{2}^{2}}}$$ where $$\mu_{1}$$ and $$\mu_{2}$$ are the mean values of the measures from device 1 and 2 respectively (a serie of measurements is undergone). After calculating those values I apply the Kalman Filter algorithm, as I would handle a single input, single output system. So there is nothing new and or special in this case. By calculating the mean value and the mean variance of both devices together I can use any kalman filter implementation I want.
2. I would like to keep the measures and the variances separated and I don't want to calculate the mean values ($$\mu_{new}, \delta_{new}$$) like (1) above, for istance because they are taken with different time intervalls or for some other reasons... Anyway... I need to rewrite my time update equations: $$\hat{\mathbf{x}}_{n+1,n} = \mathbf{F}\hat{\mathbf{x}}_{n,n} + \mathbf{G}\hat{\mathbf{u}}_{n,n}$$ and $$\mathbf{P}_{n+1,n} = \mathbf{F}\mathbf{P}\mathbf{F}^{T} + \mathbf{Q}$$ in such a way, that I can just provide both measures $$\mathbf{z}_{n}$$ from both devices and then the new state prediction is calculated at every step. But since my state vector is a position $$\mathbf{x} = [x, y, z]$$ I can't figure out, how I can treat the 2 measures independently at every iteration step (of course we consider in this case only the $$x$$ axis, since $$y$$ and $$z$$ can be put 0. Just for simplification).

Any idea?

In fact you can update the filter's state using the input from each sensor separately, you just need to use a different covariance matrix $$\mathbf{R}$$ and observation matrix $$\mathbf{H}$$ depending on the sensor. This will only affect the update step — the prediction step equations (the ones you referred to) are computed the same way regardless of the reading's source.