# All About Audio Equalization: Solutions and Frontiers
## 5 Other Equalization Filter Designs
### Matched EQ and Optimal Design Techniques  
A common problem that arises in many equalization applications is targeted or matched EQ. The goal is to find a transfer function that corresponds to a given frequency response. Most FIR filter design methods (impulse response truncation, windowing design, and optimal filter design) aim to do exactly this. However, IIR designs are often preferred and there exist several important methods to design an IIR filter for an arbitrary frequency response. These methods are considered optimal design techniques since they apply numerical optimization to the design problem. They may be classified into those where one seeks to match a complex response, and those where only the magnitude response needs to be matched. The general problem is as follows. We need to find a filter \(H(z)=B(z)/A(z)\) that is a close match to a desired frequency response \(D(\omega)\). However, finding the optimal values for the IIR filter coefficients is not easy since the frequency response is a nonlinear function of the coefficients of \(H(z)\). We generally want to minimize the solution error;  
\[E_{\text{S}}(\omega)=W_{\text{S}}(\omega)\left[\frac{B(z)}{A(z)}-D(\omega) \right]. \tag{46}\]  
But in practice the equation error is often used since it gives rise to linear equations,  
\[E_{\text{E}}(\omega)=W_{\text{E}}(\omega)[B(z)-D(\omega)A(z)], \tag{47}\]  
and either the complex values \(D(\omega)\) or the magnitudes \(|D(\omega)|\) are known. Given this, the optimization problem is usually formulated as minimize  
\[\int\limits_{-1}^{1}|E_{*}(\omega)|^{k}d\omega, \tag{48}\]  
where \(k\) is most often chosen as 2 for a least squares approach, and \(\infty\) is sometimes used for a minimax approach. The weighting functions \(W_{*}(\omega)\) control the relative importance of errors at different frequencies. Since \(D(\omega)\) is known at more values than the coefficients of \(H(\omega)\), this gives rise to an overdetermined set of equations, for which linear least squares can be used. Once the solution is found, we can then enforce stability by replacing any pole \(p\) in \(A(z)\) having a magnitude larger than \(1\) with \(1/p^{*}\). If we seek only to match a magnitude response, and the phase response is not specified, then the equation error becomes,  
\[E_{\text{E}}(\omega)=W_{\text{E}}(\omega)\left(|B(z)|-|D(\omega)||A(z)|\right), \tag{49}\]  
and similarly for the solution error. Iterative approaches can be used to find an appropriate target phase corresponding to the optimal magnitude specification, as in [95]. There are three main choices that need to be made when using this technique; the order of the filter (or alternatively, a tolerance in the error function), the weighting function to use, and the amount and locations of frequency sampling. The choice of frequency sampling is related to the appropriate choice of weighting function. Since perception is related to frequency on a log scale, we may require much more accuracy at low frequencies. Yet if our target spectrum comes from the Fourier transform of finite data, we may have uniform sampling of the spectrum. This suggests using more samples at low frequencies, and with a higher weighting. Furthermore, if computational time is important, then we may choose to use fewer samples. On the other hand, if the desired frequency response is derived from the Fourier transform of a short set of time domain samples, then we may choose to use all available samples of the frequency response, in order to maximize our information regarding the desired response. This technique is known as the _equation error_ method [96], and is based around early work on complex curve fitting [97]. A similar least squares approach was described in [98]. Improved performance may also be achieved using the output-error algorithm, which performs a damped Gauss-Newton iterative search [99], where initial conditions are chosen from the output of the equation error method.