Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


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)

http://en.wikipedia.org/wiki/Savitzky-Golay_filter.

On the Frequency-Domain Properties of Savitzky-Golay Filters.

See Also

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

History

VersionDescription
6.1.1 Function sgolayfilt added. Courtesy of Serge Steer, INRIA
Report an issue
<< sgolaydiff Filters srfaur >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:09 CEST 2024