# Kalman filter - understanding the noise covariance matrix

What is the significance of the noise covariance matrices in the Kalman Filter framework?

I am referring to:

• process noise covariance matrix Q, and
• measurement noise covariance matrix R

at any time step t.

How do I interpret these matrices? What do they represent? Do they talk about how one observation's noise varies with respect to another observation's noise in the state vector?

• Excellent intuitive explanation! I also have two questions 1. First what is the meaning of covariance of let's say 1,3 element of the acceleration covariance matrix? 2. Secondly, how does one tune the observation noise covriance matrix for the firs step of the algortihm? If that requires high computational effort or mathematics, what are some good typical values when trying to observe a multi degree of freedom vibrating system ? Thank you very much. Nov 24 '17 at 16:30
– Peter K.
Nov 24 '17 at 21:42

Roughly speaking, they are the amount of noise in your system. Process noise is the noise in the process - if the system is a moving car on the interstate on cruise control, there will be slight variations in the speed due to bumps, hills, winds, and so on. Q tells how much variance and covariance there is. The diagonal of Q contains the variance of each state variable, and off diagonal contain the covariances between the different state variables (e.g. velocity in x vs position in y).

R contains the variance of your measurement. In the above example, our measurement might just be speed from the speedometer. Suppose it's reading has a standard deviation of 0.2 mph. Then R=[0.2^2]=[0.04]. Squared because variance is the square of the standard deviation.

Q is in state space, and R is in measurement space. In the example above, our state might be position only $[x, y]^T$, and measurement space is velocity $[v]$. That is problematic because that is not velocity in terms of x and y - you need the heading to convert. The Kalman filter matrix H is used to do that conversion, and in nonlinear systems you tend to have to linearize that in some manner.

Shameless plug: my free book on the Kalman filter goes into this in great detail: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

• The book looks great!
– Royi
Jul 3 '15 at 18:57
• If your measurement variables are your state variables, does that mean [Q] = [R]? Feb 5 '20 at 5:08
• Thanks for opening the eye Feb 5 '20 at 8:52
• How to update Q and R in each iteration?
– nn0p
Nov 5 at 6:33