Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

filter_sg (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

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.


The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized


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')

Related Topics



 Was this document helpful?  submit
  Helpful Not Helpful