# How to design IIR digital filters?

Practical infinite impulse response (IIR) filters are usually based upon analogue equivalents (Butterworth, Chebyshev, etc.) using a transformation known as the bilinear transform which maps the $$s$$-plane poles and zeros of the analogue filter into the $$z$$-plane. However, it is quite possible to design an IIR filter without any reference to analogue designs, for example, by choosing appropriate locations for the poles and zeroes. Can somebody please explain the latter design of digital IIR filters (i.e., without any reference to analogue design) for the following simple example?

For a digital system with sampling frequency of 60 MHz, design a digital IIR filter with two complex conjugate poles at 23 MHz, and one zero at 18 MHz.

This is basically an equalizer for a lossy channel. The filter is flat at lower frequencies (DC attenuation), with a peaking at higher frequency and then drops rapidly. For that, only knowing the poles and zero locations should be enough which defines the DC attenuation, bandwidth, and boost (peaking) of the filter. The amount of boost or DC attenuation does not matter as they can be tweaked by changing the poles and zeros locations. So I don't think any further information is required here. But if so, simply make an assumption.

• The example you give at the bottom of your question seems (to me) to be very easily answerable: no reference to analog filters required. But the usual way to design a filter is to be given passband, stopband, and transition region specs rather than specifying the pole and zero locations. I've closed the question as duplicate. Have a read through Matt L's good answer to that one. If you think you're asking a different question, ping me here in the comments and I'll reopen.
– Peter K.
Jan 21, 2021 at 20:58
• I read Matt's answer which you referred. I don't think it was the answer to my question, he mainly explained basics about FIR filter design and also IIR using bi-linear transformation. Jan 22, 2021 at 15:39
• OK! I'm still of the opinion that designing the filter you're asking about is pretty straightforward. The only design parameter is the radius of the pole and zero positions (whether they're on the unit circle or elsewhere). Can you please extend or change your question a bit?
– Peter K.
Jan 22, 2021 at 15:55
• Well, I'm not sure what extra information is required. It's a second-order filter, with two complex conjugate poles sitting 23 MHz and one zero sitting at 16 MHz. So any kind of digital filter (given by its numerator and denominator) that its transfer function follows the zero and poles locations that I mentioned here is acceptable. Not sure what's the missing data, but if any please feel free to make an assumption that makes sense. Jan 22, 2021 at 16:08
• As I said in my first comment: But the usual way to design a filter is to be given passband, stopband, and transition region specs rather than specifying the pole and zero locations.. So, either give the filter specs in those terms or give more detail about otherwise how to choose the radius of the pole / zero locations. As it is, there is no way to choose the "right" filter.
– Peter K.
Jan 22, 2021 at 16:18

An approach to design IIR filters without mapping from classical analog designs is the least squares method where the poles and zeros are selected within a constraint of filter order and targets for the magnitude and phase of the frequency response. This can result in non-causal solutions, so some experience is necessary to do this properly. MattL who frequently posts here has provided an excellent example of this in DSP.SE #15007 and for the narrower case of all pass filters with more detail as to the algorithm at his blog post.

Similar to this is Greg Berchin's FDLS Algorthm.

Despite previous commenters decrying the design method, I found an interesting online tool at https://www.micromodeler.com which satisfies the questioner's requirement of manual placement of poles & zeros.

This is achieved by drag & drop of the represented poles & zeros on the Z-Plane, or by numerically editing their position. One can even drag a pole outside the unit circle should that be required.

The tool is available by monthly subscription but there is a "Not for Commercial Use" demo which is great for instruction & learning.

One more bit of information that is needed: the damping or Q-factor of the poles so that the continuous impulse response can be obtained.

It is sometimes useful to model a continuous-time filter in a discrete simulation. For this, an impulse-invariant, discrete-time filter can be devised.

Starting from an s-plane pole-zero transfer function, $$H(s)$$, start by computing the impulse response function, $$h(t)$$, from the partial-fraction expansion of $$H(s)$$. The form of this will be $$h(t) = \sum_{k=0}^{p-1}A_ke^{-t/\tau_k}$$ The discrete-time impulse-invariant response is simply $$h_n = h(nt_0) = \sum_{k=0}^{p-1}A_ke^{-nt_0/\tau_k}$$ The z-domain transfer function is (presuming causal; otherwise an exercise to extend this to non-causal) $$\begin{eqnarray} H(z) &=& \sum_{n=0}^\infty h_n z^{-n}\\ &=&\sum_{n=0}^\infty\sum_{k=0}^{p-1}A_ke^{-nt_0/\tau_k}z^{-n} \\ &=&\sum_{n=0}^\infty\sum_{k=0}^{p-1}A_k(e^{-t_0/\tau_k}/z)^{n} \\ &=&\sum_{n=0}^\infty\sum_{k=0}^{p-1}A_k(z_k/z)^{n} \\ \end{eqnarray}$$ where $$z_k$$ are the z-domain poles of the IIR, based on the poles of the continuous time transfer function $$H(s)$$. Continuing, for $$z$$ in the region of convergence, where $$|z|>\max_k(|z_k|)$$, we can swap the ordering of sums $$\begin{eqnarray} H(z) &=& \sum_{k=0}^{p-1}A_k\sum_{n=0}^\infty (z_k/z)^{n} \\ &=& \sum_{k=0}^{p-1} \left(A_k\over{1-z_kz^{-1}}\right) \end{eqnarray}$$ From here, you can pull the $$H(z)$$ partial sum expansion into a rational transfer function $$H(z) = B(z)/A(z)$$.

There is also an extension of this impulse invariance approach to a "covariance-invariance" approach that better matches the covariance. These approaches tend to model the spectral response well if the sample rate is sufficiently above the pole locations; however, they tend to under-represent the spectral roll-off as frequency approaches $$f_s/2$$ (i.e., at $$\pi$$), so sufficient oversampling is needed to model roll-off in the discrete model if properly representing the roll-off response is important.