1
$\begingroup$

I am working on a signal-smoothing algorithm for personal interest. I understand the basic concept of the Savitzky-Golay algorithm but I would like to understand how the coefficients were discovered. Can someone please explain the the mathematics behind it, so I could calculate the coefficients on my own?

How would the matrix look? For example here states: "For n=5 and p=3, the filtering coefficients are b= [-0.0857 0.3429 0.4857 0.3429 -0.0857]." However, it does not show the steps to achieve this. If n equal the number of points to sample and p equals the power of the polynomial.

  • 1
    The$r$e's a better derivation in Hildebrand; read the whole chapter on polynomial fitting first so you can understand how the smoothing coefficients are calculated.2010-11-06

1 Answers 1

2

This was supposed to be a comment, but it got too long.

I'm personally not too enamored of the NR routine for Savitzky-Golay myself; it has to use Gaussian elimination (and thus a two-dimensional array) for what I think is a well-structured problem. Peter Gorry's proposal in this paper is a better choice, IMHO (a proper implementation merely requires a few one-dimensional arrays; see here for a Mathematica implementation). In any event, looking at the original article by Savitzky and Golay should help you a great deal, as well as F.B. Hildebrand's Introduction to Numerical Analysis; Hildebrand does not explicitly refer to the Savitzky-Golay coefficients, but he gives the general idea of using least-squares fit polynomials for smoothing data.

  • 2
    As a matter of fact, if you won't be varying the window size and polynomial degree, you don't even need to supply a Savitzky-Golay routine; you can just use it to compute the needed coefficients for the window just once, store those coefficients in an array, and convolve as you please.2010-11-06