savgol {rchemo}R Documentation

Savitzky-Golay smoothing

Description

Smoothing by derivation, with a Savitzky-Golay filter, of the row observations (e.g. spectra) of a data set .

The function uses function sgolayfilt of package signal available on the CRAN.

Usage

savgol(X, m, n, p, ts = 1)

Arguments

X

X-data).

m

Derivation order.

n

Filter length (must be odd), i.e. the number of colums in X defining the filter window.

p

Polynomial order.

ts

Scaling factor (e.g. the absolute step between two columns in matrix X), see argument ts in function sgolayfilt. This has not impact on the form of the transformed output.

Value

A matrix of the transformed data.

Examples


X <- cassav$Xtest

m <- 1 ; n <- 11 ; p <- 2
Xp <- savgol(X, m, n, p)

oldpar <- par(mfrow = c(1, 1))
par(mfrow = c(1, 2))
plotsp(X, main = "Signal")
plotsp(Xp, main = "Corrected signal")
abline(h = 0, lty = 2, col = "grey")
par(oldpar)


[Package rchemo version 0.1-1 Index]