After struggling with prediction/correction steps for a while, I implemented a basic Kalman filter for a 1D motion model in MATLAB. Sharing a clean working example.
est_pos(k) = x(1);
% Noise Covariances Q = [0.1 0; 0 0.1]; % Process Noise Covariance (Model uncertainty) R = 1; % Measurement Noise Covariance (Sensor noise) kalman filter matlab
It is the mathematically "best" (minimum mean square error) estimator for linear systems with Gaussian noise. 🛠️ Implementation in MATLAB kalman filter matlab
% --- Kalman Filter Steps ---