DSPRelated.com
Free Books


Optimal (but poor if unweighted)
Least-Squares Impulse Response Design

Perhaps the most commonly employed error criterion in signal processing is the least-squares error criterion.

Let $ h(n)$ denote some ideal filter impulse response, possibly infinitely long, and let $ {\hat h}(n)$ denote the impulse response of a length $ L$ causal FIR filter that we wish to design. The sum of squared errors is given by

$\displaystyle J_2({\hat h}) \isdefs \sum_{n=-\infty}^\infty\left\vert h(n)-{\hat h}(n)\right\vert^2 \eqsp \sum_{n=0}^{L-1}\left\vert h(n)-{\hat h}(n)\right\vert^2 + c_2$ (5.4)

where $ c_2$ does not depend on $ {\hat h}$ . Note that $ J({\hat h})\geq c_2$ . We can minimize the error by simply matching the first $ L$ terms in the desired impulse response. That is, the optimal least-squares FIR filter has the following ``tap'' coefficients:

$\displaystyle {\hat h}(n) \isdef \left\{\begin{array}{ll} h(n), & 0\leq n \leq L-1 \\ [5pt] 0, & \hbox{otherwise} \\ \end{array} \right. \protect$ (5.5)

The same solution works also for any $ Lp$ norm4.10.1). That is, the error

$\displaystyle J_p({\hat h}) \isdefs \sum_{n=-\infty}^\infty\left\vert h(n)-{\hat h}(n)\right\vert^p \eqsp \sum_{n=0}^{L-1}\left\vert h(n)-{\hat h}(n)\right\vert^p + c_p \;\geq\; c_p$ (5.6)

is also minimized by matching the leading $ L$ terms of the desired impulse response.

In the $ L2$ (least-squares) case, we have, by the Fourier energy theorem (§2.3.8),

$\displaystyle J_2({\hat h}) \isdefs \sum_{n=-\infty}^\infty\left\vert h(n)-{\hat h}(n)\right\vert^2 \eqsp \frac{1}{2\pi}\int_{-\pi}^{\pi}\left\vert H(\omega)-{\hat H}(\omega)\right\vert^2 d\omega.$ (5.7)

Therefore, $ {\hat H}(\omega)=\hbox{\sc DTFT}({\hat h})$ is an optimal least-squares approximation to $ H(\omega)$ when $ {\hat h}$ is given by (4.5). In other words, the frequency response of the filter $ {\hat H}$ is optimal in the $ L2$ (least-squares) sense.

Examples

Figure 4.3 shows the amplitude response of a length $ 30$ optimal least-squares FIR lowpass filter, for the case in which the cut-off frequency is one-fourth the sampling rate ($ f_c=1/4$ ).

Figure: Amplitude response of a length $ 30$ FIR lowpass-filter obtained by truncating the ideal impulse response.
\includegraphics[width=\twidth]{eps/ilpftdlsL30}

We see that, although the impulse response is optimal in the least-squares sense (in fact optimal under any $ Lp$ norm with any error-weighting), the filter is quite poor from an audio perspective. In particular, the stop-band gain, in which zero is desired, is only about 10 dB down. Furthermore, increasing the length of the filter does not help, as evidenced by the length 71 result in Fig.4.4.

Figure: Amplitude response of a length $ 71$ FIR lowpass-filter obtained by truncating the ideal impulse response.
\includegraphics[width=\twidth]{eps/ilpftdlsL71}

It is not the case that a length $ 71$ FIR filter is too short for implementing a reasonable audio lowpass filter, as can be seen in Fig.4.5. The optimal Chebyshev lowpass filter in this figure was designed by the Matlab statement

hh = firpm(L-1,[0 0.5 0.6 1],[1 1 0 0]);
where, in terms of the lowpass design specs defined in §4.2 above, we are asking for
  • $ \omega_p = 0.5 \pi$ (pass-band edge frequency)5.5
  • $ \omega_s = 0.6\pi$ (stop-band edge frequency)
In this case, the pass-band and stop-band ripple are equally weighted and thus are minimized equally for the given FIR length $ L$ .5.6

Figure: Amplitude response of a length $ 71$ FIR lowpass-filter obtained by the Remez Exchange Algorithm (function firpm in the Matlab Signal Processing Toolbox).
\includegraphics[width=\twidth]{eps/ilpfchebL71}

We see that the Chebyshev design has a stop-band attenuation better than 60 dB, no corner-frequency resonance, and the error is equiripple in both stop-band (visible) and pass-band (not visible). Note also that there is a transition band between the pass-band and stop-band (specified in the call to firpm as being between normalized frequencies 0.5 and 0.6).

The main problem with the least-squares design examples above is the absence of a transition band specification. That is, the filter specification calls for an infinite roll-off rate from the pass-band to the stop-band, and this cannot be accomplished by any FIR filter. (Review Fig.4.2 for an illustration of more practical lowpass-filter design specifications.) With a transition band and a weighting function, least-squares FIR filter design can perform very well in practice. As a rule of thumb, the transition bandwidth should be at least $ 4\pi/L$ , where $ L$ is the FIR filter length in samples. (Recall that the main-lobe width of a length $ L$ rectangular window is $ 4\pi/L$3.1.2).) Such a rule respects the basic Fourier duality of length in the time domain and ``minimum feature width'' in the frequency domain.


Next Section:
Frequency Sampling Method for FIR Filter Design
Previous Section:
Lowpass Filter Design Specifications