Owning Class: filter implementation
Requires: MathScript RT Module
y = filter_sg(x, p, f, w)
y = filter_sg(x, p, f)
Legacy Name: sgolayfilt
Applies a Savitzky-Golay FIR smoothing filter.
| Name | Description |
|---|---|
| x | Specifies the input signal to filter. x is a real array. If x is a matrix, the filter operates on each column of x. |
| p | Specifies the order of the polynomial. p is a positive integer. |
| f | Specifies the number of points to use in fitting. f is a positive odd integer. |
| w | Specifies the weighting vector. w can be an empty vector or a real vector with length f. |
| Name | Description |
|---|---|
| y | Returns the filtered signal. |
x = -1:0.01:1;
y = x.^2+0.1.*rand(1, length(x));
z = filter_sg(y, 2, 15);
plot(x, y, 'r', x, z, 'b')