# Kalman Filter with two observations

I have a Kalman filter,$x_{k+1}=Ax_{k}+w_{k}$ for the state equation and $y_{k}=Cx_{k}+v_{k}$ for the observation. I have tried to implement this in Matlab, and I believe I have understood the concept pretty well. This is the set of equations used in Matlab: $$x_{k}=Ax_{k-1}$$ $$P=AP_{k-1}A^{T}+Q$$

Correction: $$K=P_{k-1}C^{T}(CP_{k-1}C^{T}+R)^{-1}$$ $$x_{k}=x_{k-1}+K(z-Cx_{k-1})$$ $$P_{k}=(I-KC)P_{k-1}$$

What I am not sure about, is how things change when we have two observations. It seems pretty obvious that it's not the naive approach of (SignalA+SignalB)/2, rather I am probably missing something? So how do the equations change with observations?

Let's say your two measurements are $y_{k,1}$ and $y_{k,2}$. Then you should be able to write measurement equations $$y_{k,i} = C_ix_k + v_{k,i} \quad \text{for }i=1,2.$$ You can equivalently write for the vector $y_k=[y_{k,1}, y_{k,2}]^T$ of concatenated measurements $$y_k = \begin{bmatrix}y_{k,1}\\ y_{k,2}\end{bmatrix} = \begin{bmatrix}C_1\\ C_2\end{bmatrix}x_{k} + \begin{bmatrix}v_{k,1}\\ v_{k,2}\end{bmatrix} := Cx_k + v_k,$$ where $C = [C_1, C_2]^T$ and $v_k$ is noise with a covariance matrix that block diagonal with $R_1$ and $R_2$ being the noise covariances of $v_{k,1}$ and $v_{k,2}$ (assuming the two measurements are independent). As you see, this is exactly the same format as in the one-measurement case just with a different measurement model matrix $C$ and noise $v_k$. The Kalman filtering equations work for this two-measurement case as you have presented.