spmvg / nfoursid

Implementation of N4SID, Kalman filtering and state-space models
MIT License
23 stars 5 forks source link

Initialize the initial state of the Kalman filter without zeroes #4

Open spmvg opened 2 years ago

spmvg commented 2 years ago

During the first steps of the Kalman filter, the initial state could be imprecise since it is initialized to zero on the first step

        x_pred = self.x_predicteds[-1] if self.x_predicteds else np.zeros((self.state_space.x_dim, 1))

This should correct after some timesteps, but there might be smarter ways to initialize the state. This was raised in this comment: https://github.com/spmvg/nfoursid/issues/1#issuecomment-1017593889

Some steps: