NMath Reference Guide

## Moving |

Class implementing data filtering by replacing data points f(i) with a
linear combination of the data points immediately to the left and right
of f(i). The user provides the coefficients to use in the linear combination.
Static class methods are provided for generating coefficients to implement a
moving average filter and a Savitzky-Golay smoothing filter.

Inheritance Hierarchy

Syntax

The MovingWindowFilter type exposes the following members.

Constructors

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

MovingWindowFilter | Constructs a MovingWindowFilter instance which implements a moving average. Number of points to the left and right both default to two. | |

MovingWindowFilter(Int32, Int32, DoubleVector) | Constructs a MovingWindowFilter instance with the specified parameters. |

Properties

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

Coefficients | Gets the filter coefficients. | |

NumberLeft | Gets the number of points left for the filter window. | |

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

NumberRight | Gets the number of points right for the filter window. | |

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

WindowWidth | Gets the width of the moving window. |

Methods

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

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

ExponentiallyWeightedMovingAverageCoefficients | Returns a vector of exponentially weighted moving average (EWMA) coefficients of length n. | |

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

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

Filter(DoubleVector, MovingWindowFilterBoundaryOption) | Applies the filter to the given data using the given boundary option. The given boundary option sets the current boundary option. | |

Filter(DoubleVector, MovingWindowFilterBoundaryOption, DoubleVector) | Applies the filter to the given data using the given boundary option and places the output in a given vector. The given boundary options sets the current boundary option. | |

MovingAverageCoefficients | Constructs the coefficient vector that implements a moving average filter when used with the MovingWindowFilter class. | |

SavitzkyGolayCoefficients | Constructs the coefficient vector that implements a Savitzky-Golay smoothing filter when used with the MovingWindowFilter class. The algorithm is also known by the terms, least-squares, or DIgital Smoothing POlynomial (DISPO). The filter coefficients, c(n) are chosen so as to approximate the underlying function in the window [i - nL, i + nR] with a polynomial, typically quadratic or quartic, and replace the point f(i) with the value of the approximating polynomial at i. The polynomial is fit using a least squares algorithm. | |

SetFilterParameters | Sets the parameters for this filter. |

Fields

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

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

numberLeft_ | The number of points to the left. | |

numberRight_ | The number of points to the right. | |

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

Remarks

The filter replaces data points f(i) with a linear combination
g(i) of itself and some number of neighboring points. The neighboring
points are determined by by parameters nL, the number of points to the left,
and nR, the number of points to the right:
g(i) = sum(n = -nL, n = nR)c(n)*f(i+n)
See also for more boundary options and
Savitzky-Golay derivatives.

C#

SavitzkyGolayFilter

See Also