ema_tc2coef

Same as previous function, but take as input the time constant (in samples).

Namespace: dsp::filter

Prototype

float ema_tc2coef(float tc)

Parameters

tcTime constant, in number of samples.

Returns

Coeficient \(\gamma\) for the IIR filter

Description

This function computes the forget factor for a first order IIR filter (that is, an exponential filter), as a function of the desired time constant.

\[ y_{n+1} = (1-\gamma) * y_n + \gamma * x_n = y_n + \gamma * (x_n - y_n) \]

\[ \gamma = 1 - e^{-1/t_c} \]