Description
Boxcar averaging is a signal smoothing technique that assumes the average of a small number of adjacent points to be a better measure of signal than any of the individual points. For example, in a 3-point boxcar, the first point is the average of points 1, 2, and 3. The second is the average of points 4, 5, and 6, and so on. Data becomes smoother as the size of the boxcar is increased; however, important details may be lost.
A similar smoothing method uses a simple moving average. For example, a 3-point moving average calculates the average of points 1, 2, and 3, then 2, 3, and 4, then 3, 4, and 5, and so on.
In this simulation, a "raw data" array of 2000 points is created consisting of four complete sine wave cycles on a background of Gaussian white noise. A new array of "averaged data" is created using either boxcar averaging or a simple moving average, both with a user-selected window size. The raw and averaged data are plotted and updated continuously, thereby simulating real-time data acquisition, and emphasizing the effect of a change in the window size.
(Reference: Skoog, Holler, and Crouch, Principles of Instrumental Analysis, 6th Ed Thomson Brooks/Cole 2007)
Exercises and questions
Why is “boxcar averaging” a good name for this technique?
At what window size does the boxcar-averaged signal begin to lose the overall shape of the non-averaged signal?
What dangers, if any, could you anticipate arising from using boxcar averaging for data smoothing?
Do you notice any differences between boxcar averaging and a moving average? Can you think of reasons why one might be more favorable than the other?