I recently implemented a Kalman filter on the simple example of measuring a particles position with a random velocity and acceleration. I found that Kalman filter worked well, but I then asked myself what’s the difference between this and just doing a moving average? I found that if I used a window of about 10 samples that the moving average outperformed the Kalman filter and I’m trying to find an example of when using a Kalman filter has an advantage to just using the moving average.
I feel like a moving average is far more intuitive than the Kalman filter and you can apply it blindly to the signal without worrying about the state-space mechanism. I feel like I am missing something fundamental here, and would appreciate any help someone could offer.
The estimate given by a moving average will lag behind the true state.
Say you want to measure the altitude of a plane rising at a constant velocity and you have noisy (Gaussian) altitude measurements. An average over a time interval of noisy altitude measurements is likely to give you a good estimate of where the plane was in the middle of that time interval.
If you use a larger time interval for your moving average, the average will be more accurate but it will estimate the plane’s altitude at an earlier time. If you use a smaller time interval for your moving average, the average will be less accurate but it will estimate the plane’s altitude at a more recent time.
That said, the lag of a moving average may not pose a problem in some applications.
edit: this post asks the same question and has more responses and resources