# Least-squares inverse filtering

A well-behaved input wavelet, such as (1, - 12) as opposed to (- 12, 1), has a z-transform whose inverse can be represented by a convergent series. Then the inverse filtering described above yields a good approximation to a zero-lag spike output (1, 0, 0). Can we do even better than that?

Formulate the following problem: Given the input wavelet (1, - 12), find a two-term filter (a, b) such that the error between the actual output and the desired output (1, 0, 0) is minimum in the least-squares sense.

Compute the actual output by convolving the filter (a, b) with the input wavelet (1, - 12) (Table 2-7). The cumulative energy of the error L is defined as the sum of the squares of the differences between the coefficients of the actual and desired outputs:

 ${L=(a-1)^{2}+(b-{\frac {a}{2}})^{2}+(-{\frac {b}{2}})^{2}}.$ (14)

The task is to find coefficients (a, b) so that L takes its minimum value. This requires variation of L with respect to the coefficients (a, b) to vanish (Section B.5). By simplifying equation (14), taking the partial derivatives of quantity L with respect to a and b, and setting the results to zero, we get

 ${{\frac {5}{2}}a-b=2},$ (15a)

and

 $-a+{{\frac {5}{2}}b=0}.$ (15b)

We have two equations and two unknowns; namely, the filter coefficients (a, b). The so-called normal set of equations (15a) and (15b) can be put into the following convenient matrix form

 ${\begin{pmatrix}{5}/{2}&-1\\-1&{5}/{2}\end{pmatrix}}{\begin{pmatrix}a\\b\end{pmatrix}}={\begin{pmatrix}2\\0\end{pmatrix}}.$ (16)

By solving for the filter coefficients, we obtain (a, b): (0.95, 0.38). Design and application of this least-squares inverse filter are summarized in Table 2-7.

To quantify the spikiness of this result and compare it with the result from the inverse filter in Table 2-3, compute the energy of the errors made in both (Table 2-8). Note that the least-squares filter yields less error when trying to convert the input wavelet (1, - 12) to a spike at zero lag (1, 0, 0).

 Filter Design Input Wavelet $w\left(t\right):\left(1,\ -{\frac {1}{2}}\right)$ The z-Transform $W\left(z\right)=1-\ {\frac {1}{2}}z$ The Inverse $F\left(z\right)=1\ +\ {\frac {1}{2}}z\ +\ {\frac {1}{4}}z^{2}\ +\ \cdots$ The Inverse Filter $f\left(t\right):\left(1,\ {\frac {1}{2}},\ {\frac {1}{4}},\ \cdots \right)$ Filter Application Truncated Inverse Filter $\left(1,\ {\frac {1}{2}}\right)$ Input Wavelet $\left(1,\ -{\frac {1}{2}}\right)$ Actual Output $\left(1,\ 0,\ -{\frac {1}{4}}\right)$ Desired Output (1, 0, 0) Convolution Table: 1 - 12 Output 12 1 1 12 1 0 12 1 - 14

We now examine the performance of the least-squares filter with the input wavelet (- 12, 1). Note that the inverse filter produced unstable results for this wavelet (Table 2-5). We want to find a two-term filter (a, b) that, when convolved with the input wavelet (- 12, 1), yields an estimate of the desired spike output (1, 0, 0) (Table 2-9). As before, the least-squares error between the actual output and the desired output should be minimal.

 Filter Design Input Wavelet $w\left(t\right):\left(-{\frac {1}{2}},\ 1\right)$ The z-Transform $W\left(z\right)=-{\frac {1}{2}}+z$ The Inverse $F\left(z\right)=-2\ -\ 4z\ -\ 8z^{2}\ -\ \cdots$ The Inverse Filter f(t): (−2, −4, −8, …) Filter Application Truncated Inverse Filter (−2, −4) Input Wavelet $\left(-{\frac {1}{2}},\ 1\right)$ Actual Output (1, 0, −4) Desired Output (1, 0, 0) Convolution Table: - 12 1 Output −4 −2 1 −4 −2 0 −4 −2 −4

The cumulative energy of the error is given by

 ${L=(-{\frac {a}{2}}-1)^{2}+(-{\frac {b}{2}}+a)^{2}+b^{2}}.$ (17)
 Filter Design Convolution of the filter (a, b) with input wavelet (1, - 12): 1 - 12 Actual Output Desired Output b a a 1 b a b − a/2 0 b a −b/2 0 Filter Application Least-Squares Filter (0.95, 0.38) Input Wavelet (1, −0.5) Actual Output (0.95, −0.09, −0.19) Desired Output (1, 0, 0)
 Input: $(1,\ -{\frac {1}{2}})$ Desired Output: (1, 0, 0) Actual Output Error Energy Inverse Filter (1, 0, −0.25) 0.063 Least-Squares Filter (0.95, −0.09, −0.19) 0.048
 Filter Design Convolution of the filter (a, b) with input wavelet $(-{\frac {1}{2}},\ 1)$ : - 12 1 Actual Output Desired Output b a −a/2 1 b a −b/2 + a 0 b a b 0 Filter Application Least-Squares Filter (−0.95, −0.19) Input Wavelet (−0.5, 1) Actual Output (0.24, −0.38, −0.19) Desired Output (1, 0, 0)
 Input: $(-{\frac {1}{2}},\ 1)$ Desired Output: (1, 0, 0) Actual Output Error Energy Inverse Filter (1, 0, −4) 16 Least-Squares Filter (0.24, −0.38, −0.19) 0.792

By simplifying equation (17), taking the partial derivatives of quantity L with respect to a and b, and setting the results to zero, we obtain

 ${\frac {5}{2}}a-b=-1,$ (18a)

and

 $-a+{\frac {5}{2}}b=0.$ (18b)

Combine equations (18a,18b) into a matrix form

 ${\begin{pmatrix}5/2&-1\\-1&5/2\end{pmatrix}}{\begin{pmatrix}a\\b\end{pmatrix}}={\begin{pmatrix}-1\\0\end{pmatrix}}.$ (19)

By solving for the filter coefficients, we obtain (a, b): (−0.95, −0.19). The design and application of this filter are summarized in Table 2-9.

Table 2-10 shows the results from the inverse filter and least-squares filter quantified. The error made by the least-squares filter is, again, much less than the error made by the truncated inverse filter. However, both filters yield larger errors for input wavelet (- 12, 1) (Table 2-10) as compared to errors for wavelet (1, - 12) (Table 2-8). The reason for this is discussed next.