# Boxcar Averaging

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

Boxcar averaging is a data treatment method that enhances the signal-to-noise of an analytical signal by replacing a group of consecutive data points with its average. This treatment, which is called smoothing, filters out rapidly changing signals by averaging over a relatively long time but has a negligible effect on slowly changing signals. Therefore, boxcar averaging mimics a software- based low-pass filter. Boxcar averaging can be done both in real time and after data acquisition is complete.

## How Boxcar Averaging Works

During Data Acquisition:

• The signal is sampled several times. Theoretically, any number of points may be used.
• The samples are summed together and an average is calculated.
• The average signal (dependent variable) is stored in the smoothed data set as the y-coordinate, and the average value of the independent variable (e.g. time, wavelength) is used as the x-coordinate.

After Data Acquisition (see figure below):

• Sum the data points within the boxcar
• Divide by the number of points in the boxcar
• Plot the average y-value at the central x-value of the boxcar
• Repeat with Boxcar 2, etc until the last full boxcar is smoothed ## Main Points about Boxcar Averaging

• Boxcar averaging is equivalent to software-based low-pass filtering.
• Boxcar averaging is straightforward to implement.
• Improvement in S/N is proportional to:

$\sqrt{\textrm{# of data points in boxcar}}$

• (N-1) points are lost from each boxcar in the smoothed data set, where N is the boxcar length. The data density of the smoothed data set will be reduced by (N-1)/N
• Significant loss of information can occur if the length of the boxcar is comparable to the data acquisition rate. It is best to implement boxcar averaging with a sufficient data acquisition rate.

## Example of Boxcar Averaging

• There are two 5 μV signals below
• Peak at 1.00 minutes with a width of 0.04 minutes
• Peak at 2.00 minutes with a width of 0.40 minutes
• Levels of boxcar averaging are as follows
• Bottom dataset: Theoretical S/N of 13 (no smoothing)
• Middle dataset: Theoretical S/N of 29 (Five-point boxcar, 0.05 min long)
• Top dataset: Theoretical S/N of 39 (Nine-point boxcar, 0.09 min long)
• Notice that little distortion occurs if the peak width is much larger than the boxcar and significant S/N enhancement is possible.
• Signals with frequencies similar to the rate of data acquisition are quickly attenuated, analogous to a low-pass RC filter. 