I recommend the use of a sum-square computation, since most electronic noise is more or less Gaussian. It takes a lot of compute time to perform such a rejection. If you are forced to average over only a few points due to time or smearing problems, then any one really bad sample will throw off the whole average. Given their random behavior, normal electronic sources of noise cannot be modelled effectively. However, often a lot of what we call noise is really some physical aspect of the system.
Waves are periodic.
Some of the better autopilots remove this error by finding the Fourier series that represents the periodic yawing, modelling the yaw, and then subtracting this effect from the compass's output. Changing sea conditions will alter the autopilot's yaw model, so the firmware must constantly recompute Fourier coefficients in a background task. Conclusion Noise reduction eats up a lot of compute power on many embedded systems. We're pushing the state of the art on some of the analog sensors, so can expect noise issues to become even more important. Please feel free to contact me via Compuserve if you have algorithms or just war stories.