Professional Documents
Culture Documents
IAR Homework 2
zk = Hxk + vk (2)
Since the state should not change from step to step and there is no control
input, we can set A = 1, B = u = 0. We have no need of transforming the
measurement taken, so H = 1. Now our equations can be written as
xk = xk−1 + wk (3)
zk = xk + vk (4)
Here wk and vk represents the process and measurement noise, with variances
Q and R, respectively. Since we assumed them to be white noise, we can write
their probabilities as normally distributed about 0.
Using all the parameters stated above, our process update equations are
x̂−
k = x̂k−1 ,
(7)
Pk− = Pk−1 + Q,
Pk−
Kk = ,
Pk− + R (8)
x̂k = x̂−
k + Kk (zk − x̂−
k ).
1
We know the true value of x to be 2 V. However we should choose values
for our initial parameters that are a little off to see how the filter estimates and
converges to the true value. Let’s guess an initial value of x̂− k−1 = 1.5 and let
the initial error covariance P0 = 1. This guess is not important because the
filter should eventually converge with enough iterations.
Simulations
100 iterations of the equations 7 and 8 will be run to demonstrate the filter for
several values of the variances Q and R. Since the measurements are corrupted
by 0.1 V RMS noise, we will pre-generate the measurements with a random
normal distribution around the true value of x, with a standard deviation of 0.1.
The measurements are pre-generated as opposed to generated within the loop
to provide the same measurements for each trial to demonstrate the difference
in choosing various values for the variances. Figures 1-5 show the estimated
values (solid blue line) and measurement values (crosses) at each iteration, as
well as the true value of x (solid green line).
Comparing Figures 1-3, we can see that decreasing R (Figure 2) leads the
estimates to be much more responsive to the measurement values (the filter
trusts the measurements more), while increasing R (Figure 3) leads the estimates
to be much less responsive to the measurements. Comparing Figures 4 and 5,
increasing Q while holding R fixed leads to much more variance in the estimate,
which makes sense since we are increasing the process variance.
2
Figure 2: Kalman Filter; Q = 1e − 5, R = 1e − 4
3
Figure 4: Kalman Filter; Q = 1e − 3, R = 0.01
4
References
[1] Welch, Greg, and Gary Bishop. ”An Introduction to the Kalman Filter.”
www.cs.unc.edu/~ welch/media/pdf/kalman intro.pdf
[2] Straw, Andrew. Kalman Filtering
http://scipy-cookbook.readthedocs.io/items/KalmanFiltering.html