NMath Reference Guide

## Savitzky |

Class SavitzkyGolayFilter is a correlation filter specialized for filtering with Savitzky-Golay
coefficients with additional boundary options for better edge continuity.
The default boundary option ShiftFilterCenter provides
data smoothing all the way boundary ends.

Inheritance Hierarchy

Syntax

The SavitzkyGolayFilter type exposes the following members.

Constructors

Name | Description | |
---|---|---|

SavitzkyGolayFilter |
Constructs a C# SavitzkyGolayFilter | |

SavitzkyGolayFilter(Int32) |
Constructs a C# SavitzkyGolayFilter | |

SavitzkyGolayFilter(Int32, Int32, Int32) |
Constructs a C# SavitzkyGolayFilter C# polynomialOrder | |

SavitzkyGolayFilter(Int32, Int32, Int32, Int32) |
Constructs a C# SavitzkyGolayFilter C# derivativeOrder |

Properties

Name | Description | |
---|---|---|

BoundaryOption | Gets/Sets the current boundary option. | |

NumberLeft | Gets the number of points left of the filtering window center point. | |

NumberOfCoefficients |
Gets the number of filter coefficients. Effectively the filter width.
(Inherited from CorrelationFilter) | |

NumberRight | Gets the number of points right of the filtering window center point. | |

WindowWidth | Gets the width of the moving window. |

Methods

Name | Description | |
---|---|---|

Clone | Creates a deep copy of this SavitzkyGolayFilter instance. | |

Correlate |
Does the correlation and takes care of internal correlation and work objects.
(Inherited from CorrelationFilter) | |

Filter(DoubleVector) |
Filters C# data (Overrides CorrelationFilterFilter(DoubleVector)) | |

Filter(DoubleVector, DoubleVector) |
Filters C# data (Overrides CorrelationFilterFilter(DoubleVector, DoubleVector)) | |

ScaleDerivative | Scales raw Savitzky-Golay derivatives given the abscissa step size. |

Fields

Name | Description | |
---|---|---|

coefficients_ |
Filtering coefficients for correlation operation.
(Inherited from CorrelationFilter) | |

work_ |
Provides a working vector for correlation results.
(Inherited from CorrelationFilter) |

Remarks

The width of the filter is: numberLeft + numberRight + 1.
Note that smoothing boundaries requires significantly more computational
effort than zero padding. The current boundary option can be set using the
property.

C#

BoundaryOption

Example

SavitzkyGolayFilter sgf = new SavitzkyGolayFilter(2, 2, 3, 0); // Width 5, Polynomial degree 3
sgf.BoundaryOption = SavitzkyGolayFilter.SavitzyGolayBoundaryOptions.DoNotFilterBoundaryPoints;
DoubleVector x = new DoubleVector(2, 1, 1, 3, 1, 1, 2);
DoubleVector z = sgf.Filter(x);

See Also