This article breaks down the foundational concepts of the Kalman filter, mirrors the teaching style found in Phil Kim's guide, and provides clear MATLAB examples to kickstart your project. What is a Kalman Filter?
% Update y = z(k) - H * x_pred; S = H * P_pred * H' + R; K = P_pred * H' / S; x_hat = x_pred + K * y; P = (eye(2) - K * H) * P_pred;
If you are tracking a car moving at a constant velocity, the Kalman filter predicts the next position based on velocity and then corrects it when the position sensor provides a new reading. The MATLAB examples show how the filter handles the trade-off between the model prediction and the sensor's noise. 4. Key Takeaways from Phil Kim's Approach
The filter starts at an incorrect guess of 10.0 . Notice how aggressively it corrects itself toward the true value ( 14.4 ) in the first few steps.
Try changing R in the code. If you make R very small, the blue line will start jumping wildly because you told the filter to blindly trust the noisy sensor. Advancing to Non-Linear Filters