3
$\begingroup$

One technique to make a high pass filter is to subtract a lowpass filter from a wire (meaning subtract the output of the filter from the input as I have demonstrated in this post).

What lowpass can you subtract from a wire that will result in an all-pass? Specifically pass all frequencies with unity gain and modify the phase only, such that the group delay is 1 sample?

This is a “DSP Puzzle”, please preface your answer with spoiler notation by typing ythe following two characters first ">!"

$\endgroup$
4
  • $\begingroup$ can you clarify the group delay requirement please? On first blush the allpass vs group delay of one sample seems in conflict. A constant delay of one sample sure is an allpass but in general a non-trivial allpass has a frequency dependent group delay $\endgroup$
    – Hilmar
    Commented Feb 25, 2023 at 1:20
  • $\begingroup$ @Hilmar To confirm, the resulting all pass will have a constant group delay over all frequencies (linear phase). Basically a lossless cable with delay (which is indeed an all-pass). I'm happy with referring to it as a "trivial allpass". $\endgroup$ Commented Feb 25, 2023 at 2:15
  • $\begingroup$ Cool. Well, this disqualifies all my favorites "add to allpass" pairs, but that's probably not what you wanted anyway :-) $\endgroup$
    – Hilmar
    Commented Feb 25, 2023 at 2:30
  • $\begingroup$ @hilmar Well actually that would be quite interesting to see and know about (but doesn’t answer this). Consider posting it as a short blog post at dsprelated.com! $\endgroup$ Commented Feb 25, 2023 at 13:38

3 Answers 3

3
$\begingroup$

Not only a lowpass filter but also a highpass filter is possible: $$\delta[n]-h[n]=\pm\delta[n-1]$$ which implies $$h[n]=\delta[n]\pm\delta[n-1]\tag{1}$$ where the positive sign in $(1)$ results in a simple first order FIR lowpass filter, and the negative sign corresponds to a highpass filter. Note that both filters, when subtracted from a wire, result in an allpass filter with a group delay of one sample. Of course, the phase responses are different.

$\endgroup$
3
$\begingroup$

Let APF $A(z)$ be $$ A(z) = \frac{z^{-N} + a_1z^{1-N} + ... + a_{N-1}z^{-1} + a_N}{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}} $$ Then define your complementary filter as $$\begin{align} H(z) &= 1 - A(z) \\ \\ &= 1 - \frac{z^{-N} + a_1z^{1-N} + ... + a_{N-1}z^{-1} + a_N}{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}} \\\\&= \frac{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}}{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}} - \frac{z^{-N} + a_1z^{1-N} + ... + a_{N-1}z^{-1} + a_N}{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}} \\ \\&= \frac{1-a_N + (a_1-a_{N-1})z^{-1} + ... + (a_{N-1}-a_1)z^{1-N} + (a_N-1)z^{-N}}{1 + a_1z^{-1} + ... + a_{N-1}z^{1-N} + a_Nz^{-N}} \\\end{align}$$

$\endgroup$
3
  • 2
    $\begingroup$ ... which shows that a filter that can be represented as the difference of two allpass filters has an anti-symmetric numerator polynomial, i.e., its zeros satisfy the same conditions as the zeros of a linear phase FIR filter (they are either on the unit circle, or they occur in pairs mirrored at the unit circle). $\endgroup$
    – Matt L.
    Commented Feb 26, 2023 at 12:10
  • $\begingroup$ I tried to format the spoiler but gave up. So what is the conclusion shown (besides interesting observation by Matt)? Or is this still in process? (I didn’t downvote) $\endgroup$ Commented Feb 26, 2023 at 23:30
  • 1
    $\begingroup$ It's not in process. It's a general answer to the general question expressed in the title. I realize that I changed the title to mean what you meant in asking the question. I also realize that the question was more specific than what was indicated in the title. I also saw Matt's answer before I wrote this. I just wanted to answer the question directly as stated in the title. $\endgroup$ Commented Feb 27, 2023 at 1:11
1
$\begingroup$

Let's consider $H[k]$ is the frequency response(DFT) of the low pass filter that is of interest - satisfies the conditions mentioned in the problem statement.

Let $x[n]$ represent the original signal and $x_{f}[n]$ be the output signal obtained by passing the signal $x[n]$ through the filter $H[k]$.Let $X[k]$ represent the N-point DFT of $x[n]$, then $$x[n] = \frac{1}{N}\sum_{k=0}^{N-1}X[k]. e^\frac{j2\pi nk}{N}$$ The filtered signal can be expressed as$$x_f[n]= \frac{1}{N}\sum_{k=0}^{N-1}H[k]X[k]. e^\frac{j2\pi nk}{N} $$ From the problem statement the following relation can be established. Let $y[n]$ represent the signal obtained by subtracting the filtered signal $x_f[n]$ from wire. Then,$$y[n] = x[n] - x_{f}[n] = \frac{1}{N}\sum_{k=0}^{N-1}(1-H[k]).X[k]. e^\frac{j2\pi nk}{N}$$ The resulting signal has a constant group delay equal to $1$ and the gain of all frequencies is unity. Hence $$|1-H[k]| = 1$$ and $$\angle{(1-H[k])} = -\frac{2\pi}{N}k $$

Two trivial solutions for $H[k]$ satisfying the above conditions are as given below:$$H[k]= 1 + e^\frac{-j2\pi k}{N} \; and \; H[k] = 1 - e^\frac{-j2\pi k}{N}$$Applying inverse Fourier transforms to the trivial solutions gives the filter response as below$$h[n] = \delta[n] + \delta[n - 1] \; and\; h[n] = \delta[n] - \delta[n - 1] $$The result is same as what Matt already has posted but the derivation is from frequency domain approach.

$\endgroup$
2
  • $\begingroup$ Nice SakSath - This is indeed the answer from a totally different angle (no pun intended) than I had considered. The result is a two-point DFT. $\endgroup$ Commented Apr 20, 2023 at 2:00
  • $\begingroup$ Thanks Dan Boschen! $\endgroup$
    – SakSath
    Commented Apr 20, 2023 at 2:07

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.