Savitzky-Golay Smoothing and Differentiation Filter
The Savitzky-Golay smoothing/differentiation filter (i.e., the polynomial smoothing/differentiation filter,
or the least-squares smoothing/differentiation filters) optimally fit a set of data points to polynomials
of different degrees.
See for detail in Matlab Documents (help sgolay). The sgolay function in Matlab can deal with only
symmetrical and uniformly spaced data of even number.
This function presented here is a general implement of the sgolay function in Matlab. The Savitzky-Golay filter
coefficients for even number, nonsymmetrical and nonuniformly spaced data can be obtained. And the filter coefficients
for the initial point or the end point can be obtained too.In addition, either numerical results or symbolical
results can be obtained.
fc = sgsdf(x,n,dn,x0,flag)
x = the original data point, e.g., -5:5
n = polynomial order, default=1
dn = differentation order (0=smoothing), default=0
x0 = estimation point, default=0
flag = numerical(0) or symbolical(1), default=0
fc = filter coefficients obtained.
1. x can be arbitrary, e.g., odd number or even number,symmetrical or nonsymmetrical, uniformly spaced
or nonuniformly spaced, etc.
2. x0 can be arbitrary, e.g., the initial point,the end point,etc.
3. Either numerical results or symbolical results can be obtained.
Jianwen Luo <firstname.lastname@example.org, email@example.com> 2003-10-05
Department of Biomedical Engineering, Department of Electrical Engineering
Tsinghua University, Beijing 100084, P. R. China
A. Savitzky and M. J. E. Golay, "Smoothing and Differentiation of Data by Simplified Least Squares Procedures," Analytical Chemistry, vol. 36, pp. 1627-1639, 1964.
J. Steinier, Y. Termonia, and J. Deltour, "Comments on Smoothing and Differentiation of Data by Simplified Least Square Procedures,"
Analytical Chemistry, vol. 44, pp. 1906-1909, 1972.
H. H. Madden, "Comments on Savitzky-Golay Convolution Method for Least-Squares Fit Smoothing and Differentiation of Digital Data," Analytical Chemistry, vol. 50, pp. 1383-1386, 1978.
R. A. Leach, C. A. Carter, and J. M. Harris, "Least-Squares Polynomial Filters for Initial Point and Slope Estimation," Analytical Chemistry, vol. 56, pp. 2304-2307, 1984.
P. A. Baedecker, "Comments on Least-Square Polynomial Filters for Initial Point and Slope Estimation," Analytical Chemistry, vol. 57, pp. 1477-1479, 1985.
P. A. Gorry, "General Least-Squares Smoothing and Differentiation by the Convolution (Savitzky-Golay) Method," Analytical Chemistry, vol. 62, pp. 570-573, 1990.
Jianwen Luo (2022). Savitzky-Golay Smoothing and Differentiation Filter (https://www.mathworks.com/matlabcentral/fileexchange/4038-savitzky-golay-smoothing-and-differentiation-filter), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!