# Formula for designing Lynn's low pass filter

For the second order Lynn's low pass filter, the general form of the transfer function is: $$H(z)=\frac{(1−z^{-m})^2}{ (1−z^{-1})^2 }$$ where $$m$$ is a positive integer. The gain for this is $$m^2$$, time delay is $$m-1$$ samples and the nominal frequency corresponding to the location of the lowest frequency zero is $$f_l = f_s /m$$. The frequency response is given by: $$|H(e^{j\omega T})|=\frac{\sin^2(m\omega /2f_s)}{\sin^2(\omega /2f_s)}$$ At the 3 dB cutoff frequency, for unit gain we have: $$|H(e^{j\omega_c T})|=\frac{\sin^2(m\omega_c /2f_s)}{m^2\sin^2(\omega_c /2f_s)} \\ \therefore \frac{1}{\sqrt2}=\frac{\sin^2(m\pi f_c /f_s)}{m^2\sin^2(\pi f_c /f_s)}$$

Now, to design the filter for our required cutoff frequency $$f_c$$ and sampling frequency $$f_s$$, we need to find the value of $$m$$ corresponding to these inputs. So how can we get this equation to the form $$m = f(f_c, f_s)$$, so that we can avoid getting the $$m$$ value by trial-and-error or numerical methods? Or is there some other quick approximation formula that we can use?

• Hi! I've never heard of "Lynn's low pass filters", could you link us to a resource? To me, your $H(z)$ is a 2-stage CIC filter's system function with a $m$-th band low pass behaviour. Design methodology for these is relatively rich, because they're used everywhere that the exact spectral shape matters way less than the performance of an implementation in hardware, but there's only one parameter to change: $m$; and as you've noticed that directly gives you the position of the first zero – so, basically, I think you've answered your own question! – Marcus Müller Mar 23 at 9:43
• (i.e. your $m$ needs to be small enough that the $f_l> f_c$, and although you could rather sensibly numerically optimize, you could also try out the maybe 4 candidates for $m$ that remain.) – Marcus Müller Mar 23 at 9:44
• Which gives raise to a whole different question: These filters are mathematically cool (they are FIR, but can be built from very few very low-complexity recursive elements). Why are you using them, however, when you're trying to achieve a specific $f_c$? – Marcus Müller Mar 23 at 9:45
• @Marcus Müller, the Lynn filters are described in Chapter 7 here: fdocuments.in/document/… – WebDev Mar 23 at 10:20
• "Biomed signal processing for the IBM PC": that's historically interesting... – Marcus Müller Mar 23 at 10:27

Just analyzing your equation, let $$a = f_c / f_s$$

Also we know that for $$m = k/(2a)$$ it reduces to $$1/(m^2 sin(\pi a))$$ for odd $$k$$ and $$0$$ for even $$k$$.

$$\lim_{m \to 0} \frac{sin^2( \pi m a)}{m^2 sin(\pi a)} = \frac{a^2 \pi^2}{sin(\pi a)} = \frac{1}{\sqrt{2}}$$

Even for this case, determining $$a$$ is not an easy task. I computed numerically the curve defined by this equation.

• good news: $m\in \mathbb N$ – Marcus Müller Mar 23 at 19:25

Meanwhile, we have got an approximation solution for this. Consider the equation: $$\frac{1}{\sqrt2}=\frac{\sin^2(m\pi f_c /f_s)}{m^2\sin^2(\pi f_c /f_s)}$$

In the right-hand side denominator, since $$f_c << f_s$$, we can write: $$sin(\pi f_c /f_s) \simeq \pi f_c /f_s$$ Also, in the numerator, since $$f_l = f_s/m$$, we have $$m\pi f_c /f_s = \pi f_c /f_l$$. Now, since $$f_c < f_l$$, we see that $$0 < \pi f_c /f_l < \pi$$. This means we can use Bhaskara I's sine approximation formula and write: $$sin(m\pi f_c /f_s) \simeq \frac{16 (\pi -(m\pi f_c /f_s)) (m\pi f_c /f_s)}{5 \pi ^2-4 (\pi -(m\pi f_c /f_s)) (m\pi f_c /f_s)}\qquad$$ Plugging these back into the main equation, simplifying and solving the resulting quadratic equation for $$m$$, we get: $$m \simeq 0.3f_s/f_c$$ This gives quite accurate results. For example, if we need to design the filter for a sampling frequency of 200 Hz and cutoff frequency of 15 Hz, we get $$m$$ as 4. This gives us $$|H(e^{j\omega_c T})|= 0.75$$

• @Marcus Müller you may find it interesting to note that in a more recent article a comparison is made between Lynn's moving average filter with $m = 32$ and standard linear phase FIR filters, which would require more than 100 taps to match the performance of Lynn's filter. – WebDev Mar 25 at 21:47
• True-linear phase characteristic that this filter has is an important requirement to preserve the relative timing of the peaks and features of the ECG waveform. – WebDev Mar 25 at 22:10