$$\mathcal{L}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\frac{1}{\pi}{\int}_{0}^{\pi}W\left(\omega \right)\phantom{\rule{0.166667em}{0ex}}{(A\left(\omega \right)-{A}_{d}\left(\omega \right))}^{2}\phantom{\rule{0.166667em}{0ex}}d\omega +\sum _{i}{\mu}_{i}\phantom{\rule{0.166667em}{0ex}}\left(A,\left({\omega}_{i}\right),-,{A}_{d},\left({\omega}_{i}\right),\pm ,T,\left({\omega}_{i}\right)\right)$$
with a corresponding derivative of
$$\frac{d\mathcal{L}}{d\phantom{\rule{0.166667em}{0ex}}a\left(n\right)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\frac{2}{\pi}\int \left(W,\left(\omega \right),\phantom{\rule{0.166667em}{0ex}},(,A,\left(\omega \right),-,{A}_{d},\left(\omega \right)\right)\frac{dA}{da}\phantom{\rule{0.166667em}{0ex}}d\omega +{\left(\sum _{i},{\mu}_{i},\frac{dA}{da}\right|}_{{\omega}_{i}}$$
The integral cannot be carried out analytically for a general weighting
function, but if the weight function is constant over each subband,
Equation 47 from Least Squared Error Design of FIR Filters can be written
$$\frac{d\mathcal{L}}{d\phantom{\rule{0.166667em}{0ex}}a\left(n\right)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\frac{2}{\pi}\sum _{k}{\int}_{{\omega}_{k}}^{{\omega}_{k+1}}\left({W}_{k},\phantom{\rule{0.166667em}{0ex}},(\sum _{m=1}^{M}a\left(m\right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega m\right)+K\phantom{\rule{0.166667em}{0ex}}a\left(0\right)-{A}_{d}\left(\omega \right))\right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega n\right)\phantom{\rule{0.166667em}{0ex}}d\omega +{\left(\sum _{i},{\mu}_{i},\frac{dA}{da}\right|}_{{\omega}_{i}}$$
which after rearranging is
$$=\sum _{m=1}^{M}\left[\frac{2}{\pi},\sum _{k},{W}_{k},{\int}_{{\omega}_{k}}^{{\omega}_{k+1}},(cos\left(\omega m\right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega n\right)),\phantom{\rule{0.166667em}{0ex}},d,\omega \right]\phantom{\rule{0.166667em}{0ex}}a\left(m\right)$$
$$-\frac{2}{\pi}\sum _{k}{W}_{k}{\int}_{{\omega}_{k}}^{{\omega}_{k+1}}{A}_{d}\left(\omega \right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega n\right)\phantom{\rule{0.166667em}{0ex}}d\omega +\sum _{i}{\mu}_{i}cos\left({\omega}_{i}n\right)\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}0$$
where the integral in the first term can now be done analytically. In matrix
notation
Equation 49 from Least Squared Error Design of FIR Filters is
$$\mathbf{R}\phantom{\rule{0.166667em}{0ex}}\mathbf{a}-{\mathbf{a}}_{{\mathbf{d}}_{\mathbf{w}}}+\mathbf{H}\phantom{\rule{0.166667em}{0ex}}\mu \phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\mathbf{0}$$
This is a similar form to that in the multiband paper where the matrix
$\mathbf{R}$ gives the effects of weighting with elements
$$r(n,m)\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\frac{2}{\pi}\sum _{k}{W}_{k}{\int}_{{\omega}_{k}}^{{\omega}_{k+1}}(cos\left(\omega m\right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega n\right))\phantom{\rule{0.166667em}{0ex}}d\omega $$
except for the first row which should be divided by
$2\phantom{\rule{0.166667em}{0ex}}K$ because of the
normalizing of the
$a\left(0\right)$ term in
Equation 49 from FIR Digital Filters and
[link] and the first
column which should be multiplied by
$K$ because of
Equation 51 from FIR Digital Filters and
[link] . The matrix
$\mathbf{R}$ is a sum of a Toeplitz matrix and a
Hankel matrix and this fact might be used to advantage and
${\mathbf{a}}_{{\mathbf{d}}_{\mathbf{w}}}$ is the vector of modified filter parameters with elements
$${a}_{{d}_{w}}\left(n\right)\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\frac{2}{\pi}\sum {W}_{k}{\int}_{{\omega}_{k}}^{{\omega}_{k+1}}{A}_{d}\left(\omega \right)\phantom{\rule{0.166667em}{0ex}}cos\left(\omega n\right)\phantom{\rule{0.166667em}{0ex}}d\omega $$
and the matrix
$\mathbf{H}$ is the same as used in
[link] and defined in
[link] .
Equations
Equation 50 from Least Squared Error Design of FIR Filters and
[link] can be written together as a matrix equation
$$\left[\begin{array}{cc}\mathbf{R}& \mathbf{H}\\ \mathbf{G}& \mathbf{0}\end{array}\right]\left[\begin{array}{c}\mathbf{a}\\ \mu \end{array}\right]\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\left[\begin{array}{c}{\mathbf{a}}_{{d}_{w}}\\ {\mathbf{A}}_{c}\end{array}\right]$$
The solutions to
Equation 50 from Least Squared Error Design of FIR Filters and
[link] or to
[link] are
$$\begin{array}{ccc}\hfill \mu & =& {\left(\mathbf{G}{\mathbf{R}}^{-1}\mathbf{H}\right)}^{-1}\left({\mathbf{GR}}^{-1}{\mathbf{a}}_{{\mathbf{d}}_{\mathbf{w}}}-{\mathbf{A}}_{\mathbf{c}}\right)\hfill \end{array}$$
$\begin{array}{ccc}\hfill \mathbf{a}& =& {\mathbf{R}}^{-1}({\mathbf{a}}_{{d}_{w}}-\mathbf{H}\phantom{\rule{0.166667em}{0ex}}\mu )\hfill \end{array}$
which are ideally suited to a language like Matlab and are implemented in
the programs at the end of this book.
Since the solution of
$\mathbf{R}\phantom{\rule{0.166667em}{0ex}}{\mathbf{a}}_{\mathbf{u}}={\mathbf{a}}_{{\mathbf{d}}_{\mathbf{w}}}$ is the optimal
unconstrained weighted least squares filter, we can write
[link] and
[link] in the form
$$\begin{array}{ccc}\hfill \mu & \phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}& {\left(\mathbf{G}{\mathbf{R}}^{-1}\mathbf{H}\right)}^{-1}\left(\mathbf{G}\phantom{\rule{0.166667em}{0ex}}{\mathbf{a}}_{\mathbf{u}}-{\mathbf{A}}_{\mathbf{c}}\right)\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\left(\mathbf{G}{\mathbf{R}}^{-1}\mathbf{H}\right)}^{-1}\left({\mathbf{A}}_{\mathbf{u}}-{\mathbf{A}}_{\mathbf{c}}\right)\hfill \end{array}$$
$\begin{array}{ccc}\hfill \mathbf{a}& \phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}& {\mathbf{a}}_{u}-{\mathbf{R}}^{-1}\mathbf{H}\phantom{\rule{0.166667em}{0ex}}\mu \hfill \end{array}$
The exchange algorithms
This Lagrange multiplier formulation together with applying the Kuhn-Tucker
conditions are used in an iterative multiple exchange algorithm similar tothe Remez exchange algorithm to give the complete design method.
One version of this exchange algorithm applies to the problem posed by
Adams with specified pass and stopband edges and with zero error weightingin the transition band. This problem has the structure of a quadratic
programming problem and could be solved using general QP methods but themultiple exchange algorithm suggested here is probably faster.
The second version of this exchange algorithm applies to the problem where
there is no explicitly specified transition band. This problem is notstrictly a quadratic programming problem and our exchange algorithm has no
proof of convergence (the HOS algorithm also has no proof of convergence).However, in practice, this program has proven to be robust and
converges for a wide variety of lengths, constraints, weights, andband edges. The performance is completely independent of the normalizing
parameter
$K$ . Notice that the inversion of the
$\mathbf{R}$ matrix is done
once and does not have to be done each iteration. The details of theprogram are included in the filter design paper and in the Matlab program
at the end of this book.