# Kalman filter, defining the measurement model

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!

• This might help dsp.stackexchange.com/questions/3292/…
– Rhei
Commented Apr 21, 2015 at 9:53
• @Peter K would you please take a look at my question ? thank you Commented Apr 23, 2015 at 8:50
• $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
– Rhei
Commented Apr 23, 2015 at 8:59
• @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 Commented Apr 23, 2015 at 9:15
• 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
– Rhei
Commented Apr 23, 2015 at 11:58

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]$.