  The Savitzky-Golay FIR digital filter is based on a least-squares polynomial
fit to a hypothetical sample of equally spaced data. This gives the filter the
ability to preserve moments of features like peaks in the input. Descriptions
of the filter typically consider the case where equal weights are implicitly
applied to the residuals of the fit. In a largely overlooked paper Turton
showed that weighting the residuals with a triangular function significantly
improves the frequency response of the filter in the stopband. The
Savitzky-Golay filter is commonly referred to as a smoothing filter. This paper
uses a particular measure of smoothness to show that a quadratic residual
weighting function optimizes the smoothness of the filter output for a given
sample size and degree of the fitting polynomial. This weighting function can
provide substantially better smoothness than that with a constant weighting
function.
