# Bireciprocal lattice wave digital filter

I have posted this question "Electrical Engineering", but this seems a more appropiate place. I am trying to model a bireciprocal Cauer filter in LTspice but I don't get the expected results. More precisely, using this formula for the coefficients

$$\gamma=\frac{re(p_i)−1}{re(p_i)+1}$$

where $$re(p_i)$$ is the realpart of the pole, gives this result:

At this point it doesn't really matter what settings were in the beginning, the "why" is in the following. Among the few references I found online, one that gives a numerical example is a thesis, Design and Realization Methods for IIR Multiple Notch Filters and High Speed Narrow-band and Wide-band Filters, L. Barbara Dai and, simply by looking at the numbers and comparing them with what I had, it seemed as if the poles need to be "normalized" to the single real pole, $$p_{\frac{N+1}{2}}$$. And so I tried:

$$\gamma=\frac{\frac{re(p_i)}{re_{\frac{N+1}{2}}}-1}{\frac{re(p_i)}{re_{\frac{N+1}{2}}}+1}$$

and, even if the numerical values still differed, but a not as before, I got this result:

The example used here is not the one used in the thesis, but I seem to get good results (I cannot verify them) with either stop-band, or transition-band optimizations and for any (odd) order.

So, my question is: are the $$A_i$$ terms from the formula $$\gamma=\frac{A_i-2}{A_i+2}$$ calculated as $$A_i=2\sigma_i$$, where $$\sigma_i$$ is the realpart of the complex s-domain $$s_i=-\sigma_i\pm j \omega_i$$ or somehow else? If else, how?

Just for the sake of comparison, the following is a test using the same settings as in the thesis: $$A_s=68 => A_p, \omega_s=\frac{2}{3} => \omega_p , f_0=2$$. The order is calculated based on these four parameters, which will result in a stop-band attenuation optimization, rather than a transition-band or a pass-band optimization. I say this because I don't know what approach Barbara Dai has.

The first simulation is with the raw values from the thesis for $$\gamma_i$$ (black trace) and the quantized values (blue trace) (surprisingly, the quantized values seem to get a better result):

If I calculate the values for $$\gamma_i$$ according to the equation from p.26 from the thesis, I get these values:

$$\gamma_1=−0.098365443613057, \gamma_2=−0.34760115224764, \gamma_3=−0.7329991130665$$

where the values for the real part(s) of the poles, $$\sigma_i$$, are:

$$\sigma_1=0.15406868065906, \sigma_2=0.48411864791316, \sigma_3=0.82088758493805$$

The results of the simulation with LTspice is this:

where the black trace is with the above coefficients and the blue trace is with Barbara Dai's unquantized.

Seeing this I tried to transform back the values for $$\gamma_{1,2,3}$$ from the thesis, to see what values for the poles were originally and compare them against my results:

$$\sigma_1^{BD}=0.15537305159045, \sigma_2^{BD}=0.48869842253758, \sigma_3^{BD}=0.83127957288835$$

which are different than mine. However, at a glance, it seemed that I could try to divide each real pole from my calculations to the value of the single, real pole at $$s_4=\sigma_4+j0 , \sigma_4=0.98572364533093$$, in order to calculate the values for the lattice coefficients (which is how the 2nd eq. from the beginning appeared), and I got these values:

$$\gamma_1=−0.091240471459003, \gamma_2=−0.34126450145251, \gamma_3=−0.72965482018797$$

and the result of the simulation is this:

with the blue trace being this result and the black trace Barbara Dai's unquantized, which seems even better even if the lobes in the stop-band aren't quite equiripple:

The case of the BLWDF implies that, given the stop-band attenuation and frequency, the pass-band attenuation and frequency can be deduced, or vice-versa. For this case, I'll impose $$A_s$$ and $$\omega_s$$ and deduce $$A_p=-10 log_{10}(1-10^{-\frac{A_s}{20}})$$ (eq. 2.51 in the above thesis) and $$f_p=\frac{f_0}{2}-f_s$$ (in the analog domain) or $$\omega_p=\frac{1}{\omega_s}$$ (in the digital domain, eq. 2.52a,b).

The example at p.27 gives $$A_s=68 \omega_s=\frac{16}{48}kHz=\frac{2}{3}$$ (normalized to $$\frac{f_0}{2}=1$$). From these: $$A_p=6.8831e-7$$ and $$f_p=\frac{1}{3}$$, or $$\omega_p=\frac{1}{1.732}=0.57735$$. Using these to find the poles would imply several approaches, due to the complexity if Cauer filters. I don't know what approach the thesis uses but, whichever the case, it shouldn't yield such differences as the ones shown in picture#3. For my case, I'll use stop-band optimization, obtained by imposing $$A_s, A_p, \omega_s$$ and $$\omega_p$$ and determining the order. The poles (zeroes are not needed here) are $$\sigma_{1,2,3}$$ below picture#3 and the result is picture#4.

If I try to reverse Barbara Dai's process, to determine what poles were used to calculate her version of $$\gamma_i$$, I get the values of $$\sigma_{1,2,3}^{BD}$$ below picture#4, which are slightly different than mine.

At this point, back then when I obtained them, it seemed to me that I could try to divide each pole to $$\sigma_4$$, the real, single pole, and so I did (second formula from above) which gave the results in picture#5, but this can't be the normal way of doing it, it was a whim tried at the moment, which gave quite the unexpected pleasant surprise. But now I'm left with the question: how are the poles derived in order to calculate the values for $$\gamma_i$$? Because it's not meant to be any different than any other Cauer filter design, with the differences in symmetry due to the bireciprocal nature.

Ultra-short-summary:

• using the coefficients calculated as $$\gamma_i=\frac{A_i-2}{A_i+2}$$, where $$A_i=2\sigma_i$$ (s-domain $$s_i=\sigma_i+j \omega_i$$), is not working (see picture#1, #4 - black trace)

• since only odd orders are valid, there is an extra single, real pole. By sheer ogling, dividing $$\sigma_i$$ to $$\sigma_{\frac{N+1}{2}}$$ gives the results in pictures #2 and #5 - black trace.

Question: Are the terms $$A_i$$ calculated as $$2 \sigma_i$$ or somehow else? If else, how?

I don't know how to explain better at this time. If there are any English errors, my apologies, it's not my native language.

• you say "Lattice Filter" but i don't see any difference equations for how you implement such. rather than plop a bunch of screenshots that don't mean much to us, can you define exactly how the input/output relationship is defined? then spell out how the coefficients are defined? – robert bristow-johnson Mar 19 '14 at 15:37
• I am not a student and this is no homework or degree or anything. It's not a filter synthesis, either, so if someone knows what a BLWDF is and can help then the equations are not needed. It's an attempt at building a <i>bireciprocal</i> LWDF (not just lattice), in LTspice, as mentioned, therefore I don't know what equations you want "plopped" here; that the implementation works, the comparative screenshots should be the proof (also compare the results with the thesis). And about how the coefficients are defined, that's part of my question, because a normal LWDF works just fine in LTspice. – Vlad Mar 19 '14 at 16:19
• I forgot to say: the example in the thesis is at page 36. – Vlad Mar 19 '14 at 16:29
• i understand Lattice filters with feedback and their reciprocal nature when the feedback paths and feedforward paths are swapped. i just would rather that you spell out what you're doing for each lattice section so we can see what the meaning of your coefficients are. your "$\gamma$" doesn't yet cut it, if it's purpose is to communicate quantitative meaning. you shouldn't make it harder for us to help you by witholding sufficient description. – robert bristow-johnson Mar 20 '14 at 2:55
• BLWDF is a special case (compare to half-band FIR filters) of lattice wave digital filters, which in turn is a class of wave digital filters. @Vlad: A BLWDF is basically a LWDF where every other adaptor coefficient is zero. The pole generated by a second order section is at +/- j*sqrt(a), where a is the adaptor coefficient. With that said, I'm not sure if I really followed the question. – Oscar Mar 20 '14 at 8:48

Let's try to sort of answer this from the BLWDF point of view (without much of the WDF-theory, since this can to a large extent be skipped as you know which structure you want).

Starting from a second-order BLWDF allpass section (based on symmetric two-port adaptors without any negations in the feedback), the transfer function is $$\frac{z^{-2}-a}{1-a z^{-2}} = \frac{1-a z^2}{z^2-a},$$ where $a$ is the adaptor coefficient (assuming the input connected to the negative side of the subtractor is the input). This has roots in $z=\pm \sqrt{a}$. Hence, the poles can be either on the real or imaginary axis in the $z$-domain. Typically, you would like to map them to the imaginary axis. This clearly hold for the standard approximations such as Cauer/Elliptic filters.

So, one approach is to design your filter directly in the $z$-domain, making sure that the poles end up on the imagniary axis and then take every other pole pair and position in every other branch.

As you mention, for this to happen, you need a anti-symmetric power complementary filter, so it should meet Feldtkeller's equation $$|H(e^{-j\omega})|^2 + |H_C(e^{j\omega})|^2 = 1,$$ where $H_C$ is the complementary filter (in the case of parallel allpass filters the sum/difference if the original filter is obtained by subtracting/adding the branches). This gives that

$$(1-\delta_c)^2 + \delta_s^2 = 1 \Rightarrow \delta_s^2 = 2\delta_c - \delta_c^2 \approx 2\delta_c \Rightarrow \delta_C \approx \frac{\delta_s^2}{2},$$ where $\delta_c$ and $\delta_s$ are the passband and stopband ripples, respectively, leading to $A_p = -20 \log_{10} (1-\delta_c)$ and $A_s = -20 \log_{10} (\delta_s)$. In addition, the passband and stopband edges should be related as $\omega_c = \pi - \omega_s$. However, the trick here is to know exactly how to select your specification so that you get a specification without any over design. If you manage that, you are home.

The same type of problem arises when you go from an analog filter. You need to have a filter, such that the specification become a spec which can be mapped to a BLWDF. Now, the relation is quite straightforward to compute, but you will need to find a spec where all four parameters (passband/stopband ripple/edge) results in an odd order filter without any over design.

While LWDF (and all filters constructed of the allpass branches in parallel) are very sensitive to coefficient quantization, the quantized results in your first comparison figure are really better since they come from a mini-max solution and are not quantized that hard. Your values are, as you've noticed, probably not computed the right way. I tend to believe the reason being that your analog filter is over designed in one way or the other, leading to that it is not actually suitable for a BLWDF, but rather an LWDF, i.e., the poles do not end up exactly on the imaginary axis after the transform. Reading your text again, I think I can confirm that this is the reason:

The order is calculated based on these four parameters, which will result in a stop-band attenuation optimization, rather than a transition-band or a pass-band optimization. I say this because I don't know what approach Barbara Dai has.

Hence, you need to adjust the specification such that there are no "optimization" in the design process.

I can extend the answer where required, but please point out where it is needed (I will, e.g., not go into the bi-linear transform for time constraint reasons right now).

• That was one of my fears and I think I understand now what went wrong: the formula $\gamma_i=\frac{\sigma_i-1}{\sigma_i+1}$ is good, but the determination of the poles in the s-domain is wrong, in that they need to be calculated for exact matching $A_s$ => $A_p$ and $f_s$ => $f_p$. So, for my approach (stop-band optimization), it's not enough to specifiy (e.g.) $A_s=68$ to deduce $A_p$, $A_s$ needs to be tuned so that the resulting order is closest to integer, without ceil(). Similarly, imposing $N$ would result in transition-band optimization and there $A_s$ can be specified to be... – Vlad Mar 21 '14 at 8:43
• $A_s=68$, then determine $A_p$ and then deduce either $f_p$ or $f_s$, one from another, in order to maintain the integer $N$ previously specified. Therefore, pass- or stop-band optimizations need to have their parameters adjusted to yield the poles closest to the imaginary axis, while transition-band optimization does that automatically to one of the four parameters, $A_s$, $A_p$, $f_s$ and $f_p$. If I got anything wrong, please let me know. In the meantime I'm back to the drawing board. If it turns out allright I'll flag this as the answer. Thank you! – Vlad Mar 21 '14 at 8:48
• s30.postimg.org/wrong6741/evrika.png (black trace - mine). Even if the results still differ (though not by much), it's done without any dividing of the poles, by imposing $N$ (transition-band optimization with adjusting $f_s$): $\frac{\sigma_i-1}{\sigma_i+1}$. This maybe because of the different(?) approach in the thesis, I don't know. To my knowledge, besides the 3 optimizations there are other two: adjusting $f_p$ (not $f_s$) with pass-band opt. and something of a mix betweet transition- and stop-band opt. Whichever the case, "I'm home". Thank you again for the guidance. – Vlad Mar 21 '14 at 9:07
• (I can't vote up, I need 15 reputation) – Vlad Mar 21 '14 at 9:09
• Glad to help and that I eventually figured out what was wrong. The more I wrote, the more convinced I got that it may have to with the over design, but it might have been a waste to throw the other things away. :-) In general, you can tweak any of the four parameters (stop/pass edge/ripple) when you do not have "integer" filter order, for bi-reciprocal with the additional constraints on the relations, so it looks indeed like you are home. – Oscar Mar 21 '14 at 11:29