first, thanks $1M for such an incredible book and set of tools - I had despaired of using Kalman filtering until I discovered them. Second, I am a lapsed C programmer, last active 10 years ago, and have been recently learning Python so as to use this library. Sorry if my inexperience is the cause of my issue.
I am trying to implement the following KF: dim x = 3 (pos, vel, acc), dim z = 2 (pos, acc) - (PS- tried to attach file but it failed):
x dim 3- spot, vel and acc,
z dim = 2, spot and acc
f = KalmanFilter (dim_x=3, dim_z=2)
f.x = np.array([[1.58], # init position
[0.01], # init velocity
[0.0]]) # init acceleration
f.F = np.array([[1.,1., 0.5], # 1, delta T, delta T^2/2 timestep = 1
[0.,1., 1.], # 0, 1, delta T
[0.,0., 1.]]) # 0, 0, 1
f.H = np.array([[1.,0., 0.], # dim_z by dim_x, i.e. 2 x 3
[0.,0., 1.]]) # measure position, and acc, but not vel
f.P = np.array([[1.,0., 0.], # covariance dim_x dim_x, i.e. 3 x 3
[0.,1., 0.],
[0.,0., 1.]])
f.R = np.array([[1.,0.], # measurement noise dim_z dim_z, i.e 2 x 2
[0.,1.]])
f.B = 0 # no control inputs
f.Q = Q_discrete_white_noise(dim=3, dt=1, var=0.5)
my measurements are stored in a .csv file as follows:
pos1, acc1,
pos 2, acc2,
etc
it actually runs for one cycle, then gives a dimensional error. the first estimate is quite incorrect
Thanks for any guidance