Hi Arda,
The function trackingKF can be used for tracking using a linear Kalman Filter. The two-body mass spring system equations can be mapped to discrete-state equations in the following manner:
Keeping terms associated with k+1 to the left and shifting everything else to the right we obtain:
By comparing with the equation x[k+1] = F[k]x[k]+G[k]u[k]+v[k], we obtain that,
F[k] = 
G[k] = 
We can also set the displacements as the elements of the measurement vector. In that case the matrix equation becomes:
By comparing this with the equation z[k] = H[k]x[k] + w[k], we obtain:
H[k] = 
Now these vectors F,G,H can be passed to the trackingKF function along with the initial state:
filter = trackingKF(F,H,G,'State',InitialState);
Please refer to the documentation links below for more details:
Hope this helps!