Class MovingAverage
Applies a moving average filter to the floating point data.
Namespace: VE3NEA.HamCockpit.DspFun
Assembly: VE3NEA.HamCockpit.DspFun.dll
Syntax
public class MovingAverage
Remarks
The classical moving average, y[n] = y[n-1] + x[n] - x[n-k], fails when applied
to the floating point data
because (a + b) - b is not always equal to a when a and b
are floating point values. For example, (1E-6 + 1E6) - 1E6 evaluates to
0, not to 1E-6.
The algorithm used in this class is designed to prevent such errors.
The filtered output is not scaled, it needs to be multiplied by the Scale factor to preserve the signal amplitude.
Constructors
| Name | Description |
|---|---|
| MovingAverage(Int32) | Initializes a new instance of the MovingAverage class. |
Properties
| Name | Description |
|---|---|
| Scale | Gets the scaling factor. |
Methods
| Name | Description |
|---|---|
| Process(Single) | Processes the specified value. |