I would like to implement a Kalman filter to estimate the velocity and position of an object. I have an accelerometer, therefore the acceleration is known. The approach is same as:

Kalman filter for position and velocity: introducing speed estimates

however, I don't understand well, how I should define the measurement model:

$\hat{X}(k+1) = \hat{X}(k) + K * ( y(k) - H*\hat{X}(k) );$

K is the kalman gain and is calculated in every step, but What is my "y" here, i know it is called the observations, but how i have my observations ? should i calculate the:

$v(k+1) = a(k)*t + v(k);$

$x(k+1) = 0.5*a(k)*t^2 + v(k)*t +x(k);$

Thank you!

  • $\begingroup$ This might help dsp.stackexchange.com/questions/3292/… $\endgroup$
    – Rhei
    Apr 21, 2015 at 9:53
  • $\begingroup$ @Peter K would you please take a look at my question ? thank you $\endgroup$ Apr 23, 2015 at 8:50
  • $\begingroup$ $y$ is given by this equation: $y_k = H*x_k + v_k$. Therefore you need to define the matrix $H$ first, which is the observation matrix. In the wikipedia example (en.wikipedia.org/wiki/…) your $y_k$ is called $z_k$. So I suggest you to have a look at that example $\endgroup$
    – Rhei
    Apr 23, 2015 at 8:59
  • $\begingroup$ @Rhei thank you very much, my problem is exactly here, i defined H, but i have some doubts to use the x. Are they my own measurements ? as an example here i have the acceleration from accelerometer and from this acceleration i can calculate the velocity and distance. Therefore, the measurements/observations would be velocity and distance by the mentioned formulas ? Im so confused at this point $\endgroup$ Apr 23, 2015 at 9:15
  • 1
    $\begingroup$ When you compute $y_k-H\hat{x}_k$ you are actually computing the difference between your observation (i.e. mesurements) and an estimate of the observation...in other words, you are updating the estimate using the measurements $y_k$. It is a sort of correction of your estimate based on your measurements $\endgroup$
    – Rhei
    Apr 23, 2015 at 11:58

1 Answer 1


Your observation are the $y_k$ your observation model is defined by $Y_k=HX_k+\eta_k$, where $\eta_k$ if a sample from a normal distribution.

If you want your kalman filter to estimate position, velocity and acceleration your state vector is : $X_k=[x_k,\dot{x}_k,\ddot{x}_k]^T$ and therefore your observation matrix is : $H=[0,0,1]$.

As stated by Rhei, your observations are what you get from the system at each time step, i.e. the measured acceleration.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.