2
$\begingroup$

Lately, I've been doing some FIR-filter simulations as a part of a programmatic circuit design course. One task was to use different constants $b_i$ for the multiplying stage of the filter and see how the response of the filter changes.

enter image description here

The filter was a 2nd order FIR-filter. First, we used the constants [1,1] for the multipliers. This created a low-pass filter. Then, we used the constants [1,-1]. This created a high-pass filter.

After this, we had to show why this is the case for these constants. We were given the hint that we can divide the input signal into a sum of a low- and a high-frequency component: $$x(n)=x_{low}(n)+x_{high}(n) $$ We were also given the following assumptions:$$x_{low}(n)≈x_{low}(n-1)\\ x_{high}(n)≈-x_{high}(n-1)$$

By looking at the picture, I calculated the expressions for the signals after each flipflop. After the first flipflop, the signal is: $$x_{1} =x_{low}(n-1)+x_{high}(n-1) = x_{low}(n) - x_{high}(n) $$ After the second flipflop: $$x_{2} = x_{low}(n-1)-x_{high}(n-1) = x_{low}(n)+x_{high}(n) $$

For the low-pass filter we, therefore, get the output: $$y_{low-pass}=1*x_{1}+1*x_{2}=2x_{low}$$ And for the high-pass filter: $$y_{high-pass}=1*x_{1}+(-1)*x_{2}=-2x_{high}$$

Why is the output of the high-pass filter negative? Does this mean the filter inverts the high-frequency components of the input?

$\endgroup$
2
  • 1
    $\begingroup$ What about $b_0$? By your calculations you set it to $0$? $\endgroup$
    – Max
    Oct 13, 2022 at 7:50
  • $\begingroup$ FYI same question was asked few days ago on EE.SE, and the question does not warn about crossposting. $\endgroup$
    – Justme
    Oct 13, 2022 at 19:31

3 Answers 3

1
$\begingroup$

The assumptions $$x_{low}(n)\approx x_{low}(n-1)$$ $$x_{high}(n)\approx -x_{high}(n-1)$$ are made to better understand the principle and get a grasp on how to quickly determine a filter's general behaviour. Low frequency components are thought of being approximatly DC or in other words a constant, so they won't change from $n-1$ to $n$. High frequency components are thought of being a sine signal with its frequency at the Nyquist frequency, so they will switch sign from $n-1$ to $n$.

But all the frequencies in between behave differently. So look at these simplifications as a kind of test balloon. Effectively, by calculating the way you did, you apply a signal consisting of DC and a sine at Nyquist frequency to your filter. By looking at the results, you can make statements about the filters behaviour at exactly these two frequencies, but not anything in between.

Thus, yes, this filter inverts the phase at $f_s/2$, but not necessarily anywhere else. You have to look at a Bode plot of its transfer function to determine what it does elsewhere.

$\endgroup$
2
  • $\begingroup$ The filter with coefficients [1,-1] doesn't invert the phase at Nyquist. $\endgroup$
    – Matt L.
    Oct 13, 2022 at 9:14
  • $\begingroup$ I assumed $b_0=0$, as he writes "after first flipflop" and "after second flipflop". $\endgroup$
    – Max
    Oct 13, 2022 at 9:56
1
$\begingroup$

First note that if you have two multipliers and one delay element, the filter order is $1$ and not $2$. The difference equation for your lowpass filter is

$$y[n]=x[n]+x[n-1]\tag{1}$$

If you assume you have an alternating input sequence of constant amplitude, then it's clear from $(1)$ that this sequence will be completely suppressed by the filter.

The given highpass filter implements the following difference equation:

$$y[n]=x[n]-x[n-1]\tag{2}$$

Clearly, a constant input signal is suppressed by that filter. Note that an alternating input sequence with constant amplitude is not inverted by that filter:

x[n]    ...  1 -1  1 -1  1 -1 ...
x[n-1]  ... -1  1 -1  1 -1  1 ...
y[n]    ...  2 -2  2 -2  2 -2 ...
$\endgroup$
1
$\begingroup$

This is a really awkward way of calculating the transfer function of a filter. If you really want to do this in this way you can write it as

$$y_{highpass}[n] = x[n]-x[n-1] = x_{low}[n] + x_{high}[n] - (x_{low}[n-1] + x_{high}[n-1]) \approx x_{low}[n] + x_{high}[n] - (x_{low}[n] - x_{high}[n]) = 2x_{high}[n]$$

No sign flip. Your problem is that $y_{highpass} = x_2-x_1$ not $x_1-x_2$.

A MUCH better way to analyze the filter is to calculate the transfer function as the z-transform of the filter impulse response:

$$H(\omega) = \sum_{n=0}^{\infty} h[n] e^{j\omega n}$$

Since you only have two non-zero coefficients this is simply sim

$$H_L(\omega) = 1 + e^{j\omega} = e^{j\omega/2}(e^{-j\omega/2} + e^{j\omega/2}) = 2e^{j\omega/2}\cos(\omega/2) $$

and similarly for the highpass $$H_H(\omega) = 1 - e^{j\omega} = e^{j\omega/2}(e^{-j\omega/2} - e^{j\omega/2}) = 2je^{j\omega/2}\sin(\omega/2) $$

The amplitude vs frequency for the lowpass is $2\cos(\omega/2)$ which is indeed 2 at $\omega = 0$ and 0 at $\omega = \pi$ which is the Nyquist frequency.

$\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.