w_savgol: Savitzky-Golay filter for not equally-spaced weighted data

View source: R/w_savgol.R

w_savgolR Documentation

Savitzky-Golay filter for not equally-spaced weighted data

Description

Smooth values using a Savitzky-Golay filter. This function is suitable for not equally-spaced and/or weighted data.

Usage

w_savgol(y, x, q, window = 7, polynom = 3)

Arguments

y

List of floats representing the "y" values.

x

List of floats representing the "x" values of the data. Must have same length as y. If missing, points are assumed to be equally-spaced

q

List of floats representing the relative weight of "y" values. Must have same length as y. If missing, all points are assumed to have the same weight.

window

Window length of datapoints. Must be odd and smaller than x. Default is 7.

polynom

The polynomial order to be used. Must be smaller than the window size. Default is 3.

Value

The smoothed "y" values.

Note

This is an R adaptation of Python function at https://dsp.stackexchange.com/questions/1676/savitzky-golay-smoothing-filter-for-not-equally-spaced-data, with the addition of weights following https://en.wikipedia.org/wiki/Savitzky-Golay_filter.

Author(s)

Luigi Ranghetti, PhD (2020) luigi@ranghetti.info


ranghetti/sen2rts documentation built on March 31, 2024, 1:18 a.m.