Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> Processamento de Sinais > Filters > sgolayfilt

# sgolayfilt

Filter signal using Savitzky-Golay Filter.

### Syntax

```xf = sgolayfilt(X, B)
xf = sgolayfilt(X, k, nf)
xf = sgolayfilt(X, k, nf, w)```

### Arguments

X

a real array. If it is a vector it contains the signal to be filtered else each column of X is filtered.

B

a real n by n array: the set of filter coefficients produced by the sgolay function.

k

a positive scalar with integer value: the fitting polynomial degree.

k

a positive scalar with integer value: the filter length, must be odd and greater than k+1.

xf

a real array: the filtered signal(s).

### Description

This function applies a sgolay filter which can be specified either by its set of filter coefficients as produced by sgolay either by the degree of the polynomial and the filter length.

According to the article the -3dB cutoff frequency can be approximated by (k+1)/(3.2*nf-4.6). Signal size should be greater than the filter length

### Examples

```dt=0.01;
t = (0:0.01:4*%pi)';
x = sin(t)+0.05*rand(t,'normal');
clf;plot(t,x,'b',t,sgolayfilt(x,3,51),'r');
gce().children(1).thickness = 2;
legend(["Raw","Filtered"]);``` ### Bibliography

Abraham Savitzky et Marcel J. E. Golay, « Smoothing and Differentiation of Data by Simplified Least Squares Procedures », Analytical Chemistry, vol. 8, no 36,‎ 1964, p. 1627–1639 (DOI 10.1021/ac60214a047)

• sgolay — Savitzky-Golay Filter Design
• filter — filters a data sequence using a digital filter
• wfir — linear-phase FIR filters

### History

 Versão Descrição 6.1.1 Function sgolayfilt added. Courtesy of Serge Steer, INRIA