📡 Kalman Filter Simulation
The "Optimal Estimator" that bridges the gap between Noisy Sensors and Inexact Models.
1 Prediction (The Model)
"Where do I think I will be based on physics?"
P⁻ = P + Q
Where Q is Process Noise (engine vibration, wind).
2 Update (The Sensor)
"How much do I trust the sensor vs my model?"
x̂ = x̂⁻ + K(z - x̂⁻)
Where R is Measurement Noise (GPS error).
Live Statistics
Mathmatical Background
The "Physics" of Noise
Q (Process Noise) represents internal uncertainty. If you increase Q, the filter starts doubting its own mathematical model and relies more on the sensor.
R (Measurement Noise) represents external sensor jitter. If you increase R, the filter assumes the GPS is "junk" and relies more on its internal mathematical prediction.
Live Gain (K) Calculation
The Kalman Gain (K) is the weight given to new information. When R is very high, K drops toward 0 (ignore sensor). When Q is high and R is low, K climbs toward 1 (trust sensor).
Visualization Legend
- White Box: The "invisible truth" (actual position).
- Red Dots: The scattered, noisy GPS measurement data.
- Blue Line: The Kalman Filter's smooth, optimal estimate.
Suggested Student Exercise
Set R (Sensor Noise) to max (20). Notice how the estimate (Blue) becomes a smooth, nearly straight line, choosing to ignore the erratic red dots.
Set Q (Process Noise) to max (1.0). Notice how the estimate starts "jumping" to follow every single red dot, even if they are clearly wrong, because it no longer trusts its own physics model.
The Optimization Challenge: Try to find the "Sweet Spot" (Balance) where the blue line stays closest to the white box with the least amount of "wobble."