How to use Kalman filter for altitude prediction based on barometer data? I have barometer noisy data with known variance.
I studied Kalman filter but I did not find an answer to this problem:
My process model is: altitude is changed because of velocity that is changed because of acceleration that is normally distributed.
 s[k+1]=s[k]+v[k]*dt+a[k]dtdt/2
Is my process state just (altitude) or (altitude and velocity) or (altitude, velocity, acceleration)?
When I use velocity and acceleration - how shall I fill the measurement matrix when measuring just altitude? In some examples, I have seen 0 as a measurement of unknown variables, but it makes no sense to me, because velocity and acceleration remain constant, because no correction is applied to them.
My goal is to mainly compute velocity.
Is there some other recommended algorithm to estimate the vertical velocity?

UPDATE:
I will try to ask the more specific question about Kalman filter :-)


I have state X = (s, v, a) - trajectory, velocity, acceleration
I have state transition model F = ((1 dt dt*dt/2)(0 1 dt)(0 0 1)) (where dt is interval between last and current measurement)
I have one-dimensional measurement Z (I measure trajectory only)
So observation model H is (1 0 0)? 


I have seen examples where only acceleration was measured and H was (0 0 1), but when acceleration was corrected, velocity and trajectory was updated also in "a priori state estimate" because velocity is dependent on acceleration. But will the velocity and acceleration be updated when they are not dependent on trajectory? See bold zeros in F matrix.
You might get good results when you consider the acceleration as an input $u$, so the model could then be written as

$$
x[k+1] = 
\begin{bmatrix}
1 &amp; \Delta t \\
0 &amp; 1
\end{bmatrix} x[k] + 
\begin{bmatrix}
\frac{\Delta t^2}{2} \\ \Delta t
\end{bmatrix} u[k] + w[k]
$$

$$
y[k] = 
\begin{bmatrix}
1 &amp; 0
\end{bmatrix} x[k] + v[k]
$$

where $x[k]$ a vector with the position and velocity and $w[k],v[k]$ zero mean Gaussian white noise. Here $v[k]$ has a covariance $R$ equal to the variance of the barometer and $w[k]$ probably has the following covariance $Q$

$$
Q = \sigma_u^2\,
\begin{bmatrix}
\frac{\Delta t^2}{2} \\ \Delta t
\end{bmatrix}
\begin{bmatrix}
\frac{\Delta t^2}{2} \\ \Delta t
\end{bmatrix}^\top
= \sigma_u^2\,
\begin{bmatrix}
\frac{\Delta t^4}{4} &amp; \frac{\Delta t^3}{2} \\
\frac{\Delta t^3}{2} &amp; \Delta t^2
\end{bmatrix}
$$

where $\sigma_u^2$ the variance of the measured acceleration (this assumes that there are not disturbance forces acting on the system).