Implementing Kalman fillter
Suppose xi is a state-scalar that admits the following recursion (so-called the first-order Gauss-Markov process):
x_{i+1} = 0.9x_{i} + n_{i}
where the process noise n_{i} is a zero-mean Gaussian random variable with variance Q_{i} = 1. We assume the initial state x_{0} is also a zero-mean Gaussian random variable with variance π_{0} = 1. Also, assume the scalar observation y_{i} and x_{i }ts the following linear model:
y_{i} = x_{i} + v_{i}
where the measurement noise vi is a zero-mean Gaussian random variable with variance Ri. Assume
E(n_{i}n_{j}^{*})= δ_{ij} , E(v_{i}v_{j}^{*})=R_{i}δ_{ij} , E(n_{i}v_{j}^{*}) = 0, E(n_{i}x_{0}^{*}) = 0, E(v_{i}x_{0}^{*}) = 0.
For (i) R_{i} = (0:9)^{i}, (ii)R_{i} = 1, (iii)Ri = (1.1)^{i} do the following and describe your results.
1. Plot π_{i} = E(x_{i}x_{i}) for i = 0; 1,....,200.
2. Plot the gains K_{p,i} and K_{f,i }for i = 0; 1,...., 200.
3. Plot R_{e,i} = E(e_{i}e_{i}); P_{i|i} = E(x^{~}_{i|i} x^{~}_{i|i}), P_{i+1|i} = E(x^{~}_{i+1|i} x^{~}_{i+1|i}), ∑_{i }for i = 0; 1,....,200.