Search Results for

    Show / Hide Table of Contents

    Class MovingAvg

    Moving-average low-pass filter

    This filter is causal, meaning that for calculating the filtered value at time k it does not use future values such as k+1, this is at the expense of introducing a time-shift/phase-shift.

    This is a finite-impulse-response type filter.

    An alterntive to this filter is LowPass, which is infinite-impulse-repsonse, and also requires less working memory(this filter needs to hold a buffer equal to bufferSize, but LowPass only needs to keep its last value in memory). LowPass will have less phase-shift/time-shift, because it places most weight on the last datapoint, whereas this filter will weight all data points in its buffer equally and thus responds sluggish.

    The advantage of this filter is that it allows you to control precisely how many past values are weighted.

    LowPass HighPass BandPass
    Inheritance
    object
    MovingAvg
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: TimeSeriesAnalysis
    Assembly: TimeSeriesAnalysis.dll
    Syntax
    public class MovingAvg

    Constructors

    | Edit this page View Source

    MovingAvg(int)

    Constructor

    Declaration
    public MovingAvg(int bufferSize)
    Parameters
    Type Name Description
    int bufferSize

    the number of samples to average, which determines the size of the buffer to create

    Methods

    | Edit this page View Source

    Filter(double)

    Add value to the moving-average filter.

    Declaration
    public double Filter(double signal)
    Parameters
    Type Name Description
    double signal

    the scalar value to be added

    Returns
    Type Description
    double

    the output of the filter, given the new value

    | Edit this page View Source

    Filter(double[])

    Run filter over a vector of values

    Declaration
    public double[] Filter(double[] signal)
    Parameters
    Type Name Description
    double[] signal

    vector of values to be filtered

    Returns
    Type Description
    double[]

    the moving-averge filtered version of values

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX