LowPassAveragingFilter

class LowPassAveragingFilter(timeConstant: Double = DEFAULT_TIME_CONSTANT) : AveragingFilter

First order IIR averaging filter. IIR (Infinite Impulse Response) filters of first order follow expressions like the one below: output = a * input + b * prevOutput, where a = 1.0-b, where: b = e^-2πfc -> ln(b) = -2πfc -> fc = -ln(b) / (2π) and fc is the cutoff frequency. For typical default values: dt = 0.02 (50 Hz) s, and timeConstant = 0.1, dt is the time interval between samples, b = timeConstant / (timeConstant + dt) = 0.1 / (0.1 + 0.02) b = 0.8333 Consequently fc = -ln(0.8333) / (2π) = 0.02 Hz

Constructors

Link copied to clipboard
constructor(input: LowPassAveragingFilter)

Copy constructor.

constructor(timeConstant: Double = DEFAULT_TIME_CONSTANT)

Properties

Link copied to clipboard

Gets a constant relative to the period between consecutive samples to determine the cut frequency of the low-pass filter. If not specified by default this is 0.1

Functions

Link copied to clipboard

Makes a deep copy from provided filter into this instance.

Link copied to clipboard

Makes a deep copy to provided filter from this instance.

Link copied to clipboard
fun filter(valueX: Double, valueY: Double, valueZ: Double, output: DoubleArray, timestamp: Long): Boolean

Filters provided values.

Link copied to clipboard
open fun reset()

Resets this filter to its initial state.