# Low pass Thiran filter difference equation in Python

I'm attempting to build a time domain low-pass Thiran filter (in Python if that is relevant) based on the original article:

https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1083363&tag=1

$$H(z)=\frac{(2N)!}{N!}\frac{1}{\displaystyle\prod_{i=N+1}^{2N}2\tau+i}\frac{1}{\displaystyle\sum_{k=0}^N(-1)^k\binom{N}{k}\prod_{i=0}^N\frac{2\tau+i}{2\tau+k+i}z^{-k}}$$

I believe I understand enough to rearrange this to the difference equation:

$$y[n]=\frac{(2N)!}{N!}\frac{1}{\prod_{i=N+1}^{2N}2\tau+i}x[n]-\sum_{k=1}^N(-1)^k\binom{N}{k}\prod_{i=0}^N\frac{2\tau+i}{2\tau+k+i}y[n-k]$$

My issue is applying this to any function blows the values for $$y[n]$$ to inf for any $$N>1$$ since the first few coefficients for $$k$$ are all $$>1$$. using the examples given in the Thiran paper for $$\tau=4$$ and $$N=5,10,15$$ have this problem so I figure there is an oversight in my implementation.

For $$N=1$$ I can push up $$\tau$$ to the point the filter works reasonably well. I assume I am missing some normalisation detail, however I'm not very well informed on this area.

Any help pointing to my mistake would be appreciated.

• Thiran filters are typically used to build fractional delay allpass filters. Are you sure that's good choice for a low pass? Chances are, you need to implement this in second order sections. High order polynomials like this are often numerically unstable specifically if the poles are close to the unit circle. Commented May 8 at 14:18
• The flat group delay is the main condition needed, so Thiran filter looked to be the best approach. Is a low order down to N=1 the natural limit here, depending on the input? Commented May 8 at 15:15
• Any linear phase filter has perfectly flat group delay. Commented May 8 at 15:27
• I see, is that simple and something I should be going back to basics to design? Commented May 8 at 15:50
• Depends on your application requirements. What are your filter specs? A linear phase filter is an FIR filter whereas the Thiran filter is an IIR. FIRs are a lot easier to design and implement. Commented May 8 at 16:30