Frequency Response Plots for Savitzky-Golay Filter Functions K. R. Betty and Gary Horlick" Department of Chemistry, University of Alberta, Edmonton, Alberta, Canada T6G 2E7
An analytical chemist often has a need to further process measured chemical signals for signal-to-noise ratio enhancement, resolution enhancement, or differentiation. A popular technique for such processing is the use of the correlation functions of Savitzky and Golay ( I , 2 ) . Correlation of two signals is equivalent to multiplication of their Fourier transforms (3).It is therefore particularly useful to know the response of these functions in the Fourier domain, i.e., their frequency response ( 4 , 5 ) .This can be determined by Fourier transformation of the original functions. The frequency response characteristics of all eleven 7- and 21-point Savitzky-Golay filter functions are shown in Figures 1 and 2. Plots of the functions are shown in columns a and c of both figures with the frequency response plots shown in columns b and d. The vertical axis is the amplitude of the Fourier transform, and the horizontal axis is frequency. Both axes are linear. The frequency axes of both plots (7- and 21point functions) extend from 0 Hz (dc) to one-half of the sampling frequency, i.e., the full unaliased range. Thus if a filter function was used to process a signal that was sampled at 0.01-s intervals (100-Hz sampling rate) the corresponding frequency response plot of the filter is interpreted as extending from 0 to 50 Hz. Where appropriate, the corrected tables of Steiner, Termonia, and Deltour (6) have been used. This was necessary for filter IV (21-point function) and both functions for filters V, VII, IX, X, and XI. In all cases the roman numeral designations of the filters correspond to those in the original tables of Savitzky and Golay ( I ) . As one scans the figures, it becomes clear that the interpretation of the action of each individual filter is aided by a knowledge of its frequency response. Filters I and I1 perform smoothing, with filter I1 having a somewhat higher frequency cutoff. The low pass nature of these filters is apparent as is the significantly lower cutoff of the 21-point functions as compared to the 7-point functions. For comparison, a larger scale figure of the frequency response plot of filter I (7-point) is shown in Figure 3 along with the corresponding plot for a conventional single stage RC low pass filter. The two filters have equivalent 3-dB points and hence cross a t this point. All the remaining filters perform differentiation. Filters 111, IV, and V take a first derivative, filters VI and VI1 a second, filters VI11 and IX a third, filter X a fourth, and filter XI a fifth. The derivative theorem of Fourier transforms states that multiplication of the Fourier transform of a signal by a linear ramp is equivalent to taking its first derivative (3).As can be seen in Figure 1 for filters 111, IV, and V, this is exactly the response in the Fourier domain with subsequent low pass rolloff in order to suppress high frequency noise. The different initial slopes of these three filters is analogous to different RC time constants for analog first-derivative (single-stage high pass) filters. Higher derivatives simply have increasing power dependence in the rising portion of their slope, i.e., f 2 for a second derivative; f 3 for a third, and so on. Plots of this nature aided our development of a simple general purpose Fourier domain digital filter, and should be compared to Figures 1and 2 of Reference 3. In order not to unduly complicate Figures 1 and 2, phase response plots hav'e not been included. However, a knowledge of a filter phase response is necessary along with its frequency
7- POINT FUNCTIONS 21- POINT FUNCTIONS C d a b
Figure 1. Seven- and twenty-one-point Savitzky-Golay filter functions (columns a and c) with their corresponding frequency responses (columns b and d). Filters I to VI
response in order to completely characterize the filter. Fortunately the phase responses of these filters are very simple. In all cases, the phase angle is constant between successive nodes in the frequency response plots. The initial phase is 0' for filters I, I1 and X; +90° for filters 111, IV, V, and XI; + B O 0 for filters VI and VII; and -90° for filters VI11 and IX. After the initial lobe, the phase angle undergoes a 180° shift at each node. For example, the phase spectrum for the seven-point function for filter 111, which performs a first derivative, is ANALYTICAL CHEMISTRY, VOL. 49,
NO. 2,
FEBRUARY 1977
851
7- POINT FUNCTIONS 21- POINT FUNCTIONS b C d a
01
,? 400L
-O01 p:
1
OO
0.125
0.25
0.375
0.5 fc
Relative Frequency Figure 3. Frequency response plots of Filter I (7-point) (solid line) and an RC low pass filter (dashed line) with equivalent 3118 points. fc is the clocking or sampling rate
filters ( 3 )and transversal filters (7). It is our hope that these plots will aid other researchers in their understanding and implementation of Savitzky-Golay correlation filters.
X
LITERATURE CITED A. Savitzky and M. J. E. Golay, Anal. Chem., 38, 1627 (1964). C. G. Enke and T. A. Nieman, Anal. Chem., 48, 705A (1976:. K. R. Betty and Gary Horlick, Appl. Spectrosc., 30, 23 (1976). H. Tominaga, M. Dojyo, and M. Tanaka, Nucl. Instrum. Methods, 98, 69 (1972). (5) R . L. LaFara, "Computer Methods for Science and Engineering", Hayden Book Co., Rochelle Park, N.J., 1973, pp 184-188. (6) Jean Steinier, Yves Termonia, and Jules Deltour, Anal. Chern., 44, 1906 (1972). (7) K. R. Betty and Gary Horlick, Anal. Chem., 48, 2248 (1976).
(1) (2) (3) (4)
RECEIVEDfor review August 23,1976. Accepted November 9, 1976. Figure 2. Seven- and twenty-one-point Savitzky-Golay filter functions (columns a and c) with their correspondingfrequency responses (columns b and d). Filters VI1 to XI
initially +90' through the first lobe, then -90' through the second lobe, and again +90° through the final lobe. We have found the type of data presented here in Figures 1 and 2 to be particularly useful in developing both digital
352
ANALYTICAL CHEMISTRY, VOL. 49,
NO. 2,
FEBRUARY 1977
CORRECTION
Transducer for Measurement of Flow Rates in Stopped-Flow Mixing Systems
In Figure l(b) of this article by F. J. Holler, S. R. Crouch, and C. G. Enke, Anal. Chem., 48, 1429 (1976), the resistor labeled 2.2 k0 should be labeled 220 Q.