2
$\begingroup$

For time series, a simple high-pass filter is obtained by subtracting the previous value from each value:

$y(n) = x(n) - x(n-1)$

If I take a multi-period difference:

$y(n) = x(n) - x(n - a)$ where $a > 1$

Is this equivalent to a band-pass filter which attenuates frequencies significantly above and below $1 / a$? If not, how can it be described in terms of high/low/band-pass filters?

$\endgroup$
2
  • $\begingroup$ "Explanation" here might help. $\endgroup$ Sep 24, 2022 at 5:09
  • $\begingroup$ @OverLordGoldDragon Thanks for the link. I ran your code and got what appears to be a filter that selects frequencies that are a multiple of 1/a. Is there a name for this type of filter? $\endgroup$
    – HAL
    Sep 24, 2022 at 6:05

1 Answer 1

7
$\begingroup$

What you are describing is two cases of a more general form of a Comb Filter (I encourage you to go through the link, but I'll adapt to your particular case here): $$y(n) = x(n) + \alpha x(n-K) $$ with $K$ the delay in samples, and $\alpha$ the scaling factor applied to the delayed signal. In your case, you have $\alpha = -1$, which gives you $$y(n) = x(n) - x(n-K)$$


To figure out what kind of filter this is, let's move to the frequency domain:

  1. Take the $\mathcal{Z}$-transform and derive the transfer function:

\begin{align*} Y(z) &= X(z) - z^{-K}X(z)= X(z)(1-z^{-K})\\\\ \implies H(z) &= \frac{Y(z)}{X(z)} = 1 - z^{-K} \end{align*}

  1. Substitute $z = e^{j\omega}$ to get the frequency response: $$H(\omega) = 1 - e^{-j\omega K}$$ At this point, you can note that for $\omega = 0$, $H(\omega) = 0$ so you can rule out "low-pass".

  2. Let's go further, and compute the magnitude response:

\begin{align*} \vert H(\omega) \vert &= \vert 1 - e^{-j\omega K} \vert \\\\ &= \vert 1 - \cos{(\omega K)} + j\sin{(\omega K)} \vert \\\\ &= \sqrt{1 - 2 \cos{(\omega K)} + \cos^2{(\omega K}) + \sin^2{(\omega K})}\\\\ &= \sqrt{1 - 2 \cos{(\omega K)} + 1}\\\\ &= \sqrt{2 - 2 \cos{(\omega K)}}\\\\ &= \sqrt{2\vphantom{1 - \cos{(\omega K)}}} \cdot \sqrt{1 - \cos{(\omega K)}} \end{align*}

  1. Let's now analyze the magnitude response:
  • $\vert H(\omega) \vert$ is periodic (since you have a cosine term).

  • $\vert H(\omega) \vert = 0$ for $\omega = 2\pi / K$ since $ \cos{(2\pi)} = 1$, but ALSO for $\omega = 4\pi / K$ since $\cos{(4\pi)} = 1$
    As a matter of fact, $\vert H(\omega) \vert = 0$ (the nulls) for every integer $k$ such that: $$\omega = \frac{2\pi k}{K}$$

  • Similarly, the maxima (the peaks) happen when $\cos{(\omega K)} = -1$, at $k$ such that: $$\omega = \frac{\pi k}{K}$$ At these peaks, $\vert H(\omega) \vert = 2$


The resulting magnitude response looks like a comb, hence the term Comb Filter.

Here are a few examples for different values of $K$ on a logarithmic scale, restricting ourselves to the normalized Nyquist frequency $\pi$, and normalizing by the peak value ($\vert H(\omega) \vert = 2$) so that the maxima fall at $0\,\texttt{dB}$:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.