I am implementing my own discrete Kalman filter to estimate velocity from acceleration and position measurements (using Matlab ).
I think I managed to deal with the $R$ matrix (measurements noise covariance matrix) in this way:
M = [x;x2dot];
R = cov(M);
What I am not sure about is the matrix $Q$.
In all the examples I found on the web and on this website also, the values inside that matrix are really really small. Moreover, I found here this statement:
if you select an overly large Q, then it doesn’t seem like the Kalman filter would be well-behaved.
The fact is that, in my model, to obtain acceptable results I used values in the order of $1e6$ on the diagonal of the $Q$ matrix.
In this way I got the estimated displacement equal to the measured one and the estimated acceleration equal to the measured one. The velocity is in the right range of values but it still looks noisy.
So the question is: is there a limit for the values to be used in $Q$?
And also, are there guidelines to choose those values?
EDIT
Last question, does the $Q$ matrix have to be diagonal or it can be full also?
Answer
First and foremost I really recommend this great textbook project about Kalman filtering. You can find some words about setting the process noise here. There is also a pdf version of it.
In every step the filter estimates a multivariate normal distribution with parameters $\mu = x$ (state vector) and $\sigma = P$ (covariance matrix).
By looking the Kalman filter equations you can see that $Q$ is added to the predicted $FPF^T$. By doing this we 'artificially' smear the new normal distribution, increasing the uncertainty of our prediction. It also means that we raise the probabilities of the state vectors near $x$.
So if you choose $Q$ with huge values compared to those of $P$ you essentially say that the model does a bad job predicting the process and we really have to extend the range we think the true state vector lies in.
You are free to choose a full matrix to be $Q$ as long as it is a valid covariance matrix. A diagonal $Q$ means that your state parameters are independent from each other. The section about the multivariate normal distribution can give you more insight as well as examples.
No comments:
Post a Comment