# Time-averaging as a low-pass filter?

I run into the following filter that is supposed to do some type of time averaging of $x$

$$y[n]=G\cdot y[n-1]+(1-G)\cdot\dfrac{x[n]-x[n-1]}{T}$$

where

$$G=e^{-2\pi c T}$$

$T$ is a time interval, and the samples of $x$ and $y$ come every $T$ seconds (we can assume $y = 0$).

The definition includes a quantity $c$ that I think acts as some sort of cut-off frequency, but I am not sure. Can this type of time-averaging be seen as a low-pass filter? If so what type of filter, and how can I relate $c$ to $T$ considering that the samples come every $T$ seconds?

• This will likely be useful to you: see appendix G.1 in the book linked toward the bottom of the page here (it's available for free).
– MBaz
Oct 9, 2014 at 13:46

first of all, if i were the OP, i would fix the notation a bit. $x(t)$, $y(t)$ are continuous-time signals and $t\in\mathbb{R}$ is a continuous argument. $x[n] \triangleq x(nT)$ and $y[n] \triangleq y(nT)$ are discrete=time signals and and $n\in\mathbb{Z}$ is a discrete argument, an integer. square brackets mean that an integer goes into them. the normal convention is that $T=\frac{1}{f_s}$ is your sampling period.

a simple moving-average filter with equal-weighting in the average is

\begin{align} y[n] & = \frac{1}{N} \sum\limits_{i=0}^{N-1} x[n-i] \\ & = \frac{1}{N} \left(x + \sum\limits_{i=1}^{N} x[n-i] - x[n-N]\right) \\ & = \frac{1}{N} \sum\limits_{i=1}^{N} x[n-i] + \frac{1}{N} \left(x - x[n-N]\right) \\ & = \frac{1}{N} \sum\limits_{i=0}^{N-1} x[n-1-i] + \frac{1}{N} \left(x - x[n-N]\right) \\ & = y[n-1] + \frac{1}{N} \left(x - x[n-N]\right) \\ \end{align}

that is representing both the non-recursive implementation and the recursive. the recursive implementation works as long as you subtract exactly what you earlier added, something that might not happen in a floating-point context. both are FIR, even though the recursive implementation is something we would call a Truncated IIR, still an FIR.

to get the frequency response, apply the Z-Transform to either form, and solve for $Y(z)$ in terms of $X(z)$. then compute the transfer function:

$$H(z) \triangleq \frac{Y(z)}{X(z)}$$

then substitute $z = e^{j \omega}$ and solve for the $\omega$ such that $\left|H(e^{j \omega})\right|^2 = \frac{1}{2}$. that $\omega= 2\pi f T$ is your -3.01 dB cut-off frequency.

try doing that math yourself. we'll be here to help guide you.