# What exactly is Savitzky-Golay differentiation filter?

I could understand Savitzky-Golay filter as being smoothing filter, but then there also seems to be Savitzky-Golay differentiation filter, though for some reason, details do not seem to be clear.

So is Savitzky-Golay differentiation just about inferring first-order derivative from a local polynomial used for each data point? (This local polynomial least square method is another way of thinking about Savitzky-Golay, so by local polynomial I mean exactly that.)

If so, would frequency response of such a differentiation filter be simply multiplying $$i\omega$$ to frequency response of an original Savitzky-Golay filter?

Your first suggestion is correct, the derivatives of the local polynomials are being sampled. From the horse's mouth (Savitzky & Golay 1964):

Again, if we restrict ourselves to evaluating the function only at the center point of a set of equally spaced observations, then there esist sets of convoluting integers for the first derivative as well. (These actually evaluate the derivative of the least squares best function.)

About your second question: No, differentiation cannot be moved to the discrete-time domain without affecting the result. The number of taps is equal between any given Savitzky–Golay filter and all Savitzky–Golay derivative filters for the same polynomial degree and number of input samples used to construct the polynomial. This indicates that Savitzky–Golay derivative filters are not derived from the corresponding Savitzky–Golay filter by further discrete-time filtering, because that would increase the length of the impulse response.

As a reality check, it can be observed that the zeros of the frequency responses of the 0th and 1st derivative filters do not match, so one can not be produced by filtering the other: Figure 1. 2nd-order 9-point Savitzky–Golay (blue) and 1st derivative filter (red) magnitude frequency responses.

Octave source code for the plot:

graphics_toolkit("gnuplot");
N=9;
f = sgolay(2, N, 0)((N+1)/2,:);
g = sgolay(2, N, 1)((N+1)/2,:);
[hf, wf] = freqz(f, , 4096);
[hg, wg] = freqz(g, , 4096);
plot([wf, wg], 20*log(abs([hf, hg]))/log(10));
xlim([0, pi]);
ylim([-100, 0]);
xlabel('\omega');
ylabel('abs(frequency response) (dB)');


## References

Abraham. Savitzky and M. J. E. Golay, "Smoothing and Differentiation of Data by Simplified Least Squares Procedures", Analytical Chemistry 1964 36 (8), 1627-1639 DOI: 10.1021/ac60214a047

• Multiplication by $j\omega$ in the interval $[-\pi,\pi]$ would make sense though in the discrete-time domain, and that's how I understood the OP's suggestion. This is not totally unreasonable, even though it would make the filter IIR. – Matt L. Jan 1 '19 at 21:51
• @MattL. that is correct. I think I can remove that paragraph. – Olli Niemitalo Jan 1 '19 at 22:04