# How to design a filter with custom group delay — why is it an IIR?

Say I have an FIR filter with desired magnitude characteristics. I could imagine using an allpass IIR in series with the FIR to alter the group delay characteristic to provide both a 'magnitude equalization' and 'delay equalization' curve custom for the application.

I imagine this would be simpler in the frequency domain where the imaginary component of each slice of the FFT would adjust the group delay of a bandwidth corresponding to the nyquist frequency of the system divided by the FFT length, and then IFFT'ing to find the impulse response, windowing that impulse response to design the filter.

I see Matlab has an IIR feature for custom group delay in fdatool. Why does it have to be an IIR? Can an FIR have a custom group delay?

Thanks for any pointers!

As pointed out by Peter K., it is true that many well-known techniques for designing FIR filters actually only design linear phase filters. However, FIR filters are very well suited for delay equalization, simply because the design process is much simpler than for IIR filters. The reason for this is the fact that the design problem can be formulated in such a way that it is still linear in the unknown filter coefficients, which is usually not the case for IIR filters. This type of design problem is known as complex approximation problem, because in the case of a desired non-linear phase response a complex frequency response must be approximated by the filter, unlike a real one in the case of a linear phase filter. You can find a lot about this topic, including Matlab programs, in this thesis. Have a look at the design example #2 on page 119 ff. where an FIR magnitude and phase equalizer is designed compensating the effects of an analog anti-aliasing filter. The following figure is taken from the thesis and it shows the group delay of the analog low pass filter, the group delay of the equalizer(s) (there are two with different magnitude responses), and the total group delay of the cascade of analog and digital filter, which is supposed to be constant in the passband: • hey now that's useful! so humble, this is your thesis (: – panthyon Nov 19 '14 at 22:29
• Nice one, Matt! – Peter K. Nov 20 '14 at 12:39

Most FIR filters are linear phase as their coefficients are (anti-)symmetric. So, most FIR filter design techniques are targeted at linear phase designs.

That means FIR filters are not much good at equalizing group delay -- linear phase FIR filters all have constant group delay.

IIR filters, on the other hand, generally have non-linear phase. That means techniques have arisen that allow shaping of the phase and, therefore, the group delay.

That's not to say that FIR filters without the (anti-)symmetry constraint can't be designed to improve group delay, though.