sgolayqr(degree,hw,​w)

This code correctly computes Savitzky-Golay filters. It is a replacement for the Matlab sgolay code.
44 Downloads
Updated 24 Mar 2016

View License

This code computes Savitzky-Golay filters using a method similar to that used in the Matlab sgolay code. However, this implementation is far less prone to problems due to conditioning. Furthermore, the built-in sgolay code gives incorrect answers for the weighted filters due to errors in implementation (easily verified by using a uniform weight that is not 1 which should not change the answer but does in Matlab's built-in code). This code correctly computes the filters when using non-uniform weights. The derivation and analysis of the algorithm used is available at:
"Numerically Sane Construction of Polynomial Least Squares Filters via QR Factorization", by C.F. Borges, 15 MARCH 2016, NPS Institutional Archive. Full paper available at https://calhoun.nps.edu/handle/10945/48144

Cite As

Carlos Borges (2026). sgolayqr(degree,hw,w) (https://www.mathworks.com/matlabcentral/fileexchange/56149-sgolayqr-degree-hw-w), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0