You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uses the Savitzky-Golay filter based in the array of y values(data) and the difference between x dots(h).
Options:
windowSize: The amount of dots used to make the filtering evaluation, the default value is 5.
derivative: The grade for the derivative, the default value is 1.
polynomial: The grade of the polynomial function to use for calculation, the default value is 2.
pad: How to pad the array to handle borders. Can be one of:
'none' (default): No padding. The resulting array will be smaller than the original one.
'pre': Pad the original array before applying the filter
'post': Pad the resulting array after applying the filter
padValue: If pad is not none, Determine how to fill the values, if the value don't match with the next strings, the new values are going to be filled with that value.
The default value is 0. The special strings are:
'circular': Pad with circular repetition of elements within the dimension.
'replicate': Pad by repeating border elements of array.
'symmetric': Pad array with mirror reflections of itself.
Examples
Smoothing
constsavitzkyGolay=require('ml-savitzky-golay');letdata=[/* ... */];letoptions={derivative: 0};letans=savitzkyGolay(data,1,options);console.log(ans);// smoothed data