Savitzky-Golay differentiation Filter

Design an FIR Savitzky-Golay robust differentiation filter of length, Order+1, Derivative, Derv and polynomial fit, Polyfit. These types of filters are good for feature extraction (e.g. biomedical data), as they combine robust differentiation with lowpass filtering.

Syntax
Hd = savgolaydiff(Order, Polyfit, Derv, DFormat)

Description
Order: may be specified up to 499 (professional) and up to 128 (educational) edition.

Polyfit: Polynomial fit, which must be < Order+1

Derv: 1 < Derv < PolyFit

Hd: the savgolay method designs an FIR Savitzky-Golay robust differentiation filter based on the entered specifications and places the transfer function (i.e. numerator and gain) into a digital filter object, Hd. The digital filter object can then be combined with other methods if so required. For a digital filter object, Hd, calling getnum(Hd) and getgain(Hd) will extract the numerator and gain coefficients respectively – see below.

DFormat: allows you to specify the display format of resulting digital filter object.

symbolic Display a symbolic representation of the filter object. If the order > 10, the symbolic display option will be overridden and set to numeric.
numeric Display a matrix representation of the filter object
void Create a filter object, but do not display output

Examples
[code lang=”java”]
ClearH1; // clear primary filter from cascade

interface M = {2, 50,2,24};
interface P = {2, 10,1,4};
interface D = {1, 10,1,2};

Main() // main loop

Hd=savgolaydiff(M,P,D,”numeric”); // Design Savitzky-Golay Differentiator filter

Num=getnum(Hd);
Den={1};
Gain=getgain(Hd);

[/code]
See also:

movaver / firwin / firarb / firkaiserfirgaussfirlp2notchsavgolay