Implementing 1D Kalman filter