# Why these cross-connections in the allpass filter?

Why these cross-connections in the allpass filter?

and what do negative and positive $k_1$ really refer to?

Is it when the signal is going downwards or is it when the signal is below the zero line?

• It's a ladder filter – user28715 Jul 15 '17 at 17:11
• @StanleyPawlukiewicz, it's one rung of the ladder. to the OP, your diagram is exactly the same as this diagram but folded around differently. the $k_1,k_2...$ are gains and all of them have magnitude less than one. just analyze the block diagram (either folded over like above or the other one) and obtain the transfer function $H(z)$ and you will see it's an APF. – robert bristow-johnson Jul 15 '17 at 21:32
• @robertbristow-johnson So are signals treated as their amplitudes being between [0,1] in this context, rather than [-1, 1]? – mavavilj Jul 16 '17 at 9:15
• the signals $x[n]$ can be anything. but $-1 \le k_1 \le +1$ and same for $k_2$. this is needed for stability. – robert bristow-johnson Jul 16 '17 at 9:17
• @robertbristow-johnson But don't the signals have to have negative and positive parts in order for the gains being in [-1,1] to make any sense? Since I believe that the idea of $-k_1$ here is to "negate" the effect of $k_1$. – mavavilj Jul 16 '17 at 9:20

## 2 Answers

Let me provide the same answer as provided by @msm,

First of all I would like to replace the lattice with the following block diagram :

In which I would like to introduce two new variables $v[n]$ and $w[n]$ to simplify the derivation. Let's use the $\mathcal{Z}$-transform approach which yields the easiest solution:

From the diagram it's obvious that: $$Y(z) = W(z) + k_1 V(z)$$ $$W(z) = z^{-1} V(z)$$ $$V(z) = X(z) - k_1 W(z)$$

The last two lines can be combined to produce: $$X(z) = (1 + k_1 z^{-1}) V(z)$$

Then the first line becomes: $$Y(z) = z^{-1} \left( \frac{X(z)}{1 + k_1 z^{-1}} \right) + k_1 \left( \frac{X(z)}{1 + k_1 z^{-1}} \right)$$

After simplifying you get: $$Y(z) = X(z) \left( \frac{k_1 + z^{-1}}{1 + k_1 z^{-1}} \right)$$

and therefore the transfer function of the system is: $$H(z) = \frac{Y(z)}{X(z)} = \frac{k_1 + z^{-1}}{1 + k_1 z^{-1}}$$

as msm stated it's an all-pass filter whose magnitude response is unity and therefore used for its phase response instead...

• both you and msm get a +1 from me. and also for pointing out that this one rung of the ladder is the same signal flow topology as the standard left-to-right block diagram. one thing that i will point out is that the unit delay element $z^{-1}$ need not be just a unit sample delay. it can be a delay of any amount and this is still an APF. in fact, that delay element does nothing other than change the phase of the signal passing through it (delay elements are "linear phase" changers) so that delay element could be replaced with another APF. we might call that "nested APFs". – robert bristow-johnson Jul 15 '17 at 21:38
• Thanks for the +1! DSP world is not really paying back well enough, considering the amount of extreme hard work involved :-) Regarding your definition of the nested APFs. The phase response of an APF is not linear, due to its pole, so wouldn't that cause a problem there? (in conjunction with your previous statement of linear phase property of the delay element to be used in replacement) – Fat32 Jul 15 '17 at 22:12
• consider what makes this an APF. the internal delay is the only component that discriminates w.r.t. frequency. the reason the APF has it's own phase change (which is non-linear, but can be made to approximate linear phase when the pole is < 0. so the internal nested APF just replaces that role, but at some specific frequency, shifts the phase by a different amount. – robert bristow-johnson Jul 16 '17 at 1:37
• but it's still first-order, so that's just a complicated way to change $k_1$ . you make it a second-order APF if this nested internal APF is also in series with a $z^{-1}$ unit delay. and that is exactly the form of a 2nd-order APF in ladder form. – robert bristow-johnson Jul 16 '17 at 1:40
• Yes, but WHY are the gains there? I didn't ask, whether it's an allpass or not, but why does an allpass structure have those cross-connections? – mavavilj Jul 16 '17 at 9:13

This is called a lattice structure implementation of all-pass filters.

$k_1$ and $-k_1$ are scalar gains. The input to the delay element is $$a[n]=x[n]-k_1a[n-1]$$ taking the $z$-transform, the transfer function is $$A(z)(1+k_1z^{-1})=X(z)\Rightarrow A(z)=\frac{X(z)}{1+k_1z^{-1}}$$ and the output is \begin{align} y[n]&=k_1a[n]+a[n-1]\\ \end{align} Thus \begin{align} Y(z)&=A(z)(k_1+z^{-1})\\ &=X(z)\frac{k_1+z^{-1}}{1+k_1z^{-1}} \end{align} $$H(z)=\frac{Y(z)}{X(z)}=\frac{k_1+z^{-1}}{1+k_1z^{-1}}$$ So it is an all-pass filter ($|H(e^{j\omega})|=1,\ \forall \omega$) with mirrored coefficients in numerator and denomerator.

• to show that $|H(e^{j\omega})|=1$ you should substitute $z \leftarrow e^{j\omega}$ and grind it out. – robert bristow-johnson Jul 15 '17 at 21:42
• Yes, but WHY are the gains there? I didn't ask, whether it's an allpass or not, but why does an allpass structure have those cross-connections? – mavavilj Jul 16 '17 at 9:13
• You probably know why the delay element is there (since you didn't ask about it). The two gains are also there for the exact same reason :) More seriously: They overall lead to a desired input-output relation. If you know other ways to combine two gains and a delay that achieve an all-pass input-output relationship (and you can prove it as I did), then they are also acceptable structures (maybe with different features and pros and cons), and you can publish it is your paper/book @mavavilj. – msm Jul 16 '17 at 12:43
• Good, you can add your new answer as well. – msm Jul 16 '17 at 13:05