N-1 y(k) = SUM h(i) x(k-D(i)) , i=0where x(i) is the input signal. The filter error is
e(k) = d(k) - y(k) ,
where d(k) is the desired signal. To minimize the mean-square filtering error, solve
R h = r,
where R is the symmetric positive definite covariance matrix, h is the vector of filter coefficients and r is a vector of correlation values. The matrix R and and vector r are defined as follows
R(i,j) = E[x(k-D(i)) x(k-D(j))], for 0 <= i,j < N, r(i) = E[x(k) d(k-D(i))], for 0 <= i < N.
The solution is determined using a Cholesky decomposition of the matrix R. The resulting mean-square filtering error can be expressed as
ferr = Ed - 2 h'r + h'R h = Ed - h'r ,
where Ed is the mean-square value of the desired signal,
Ed = E[d(k)^2] .
The expectation operator E[.] is often replaced by a sum over k over an interval, say 0 <= k < Nk. Minimization of the prediction error over this finite interval defines the so-called covariance method for determining the filter coefficients. If the filter delays are of the form D(i) = Nd + i,
Nk-1 R(i,j) = SUM x(k-i-Nd) x(k-j-Nd) . k=0Furthermore, if the desired signal is x(k), the cross-correlation vector r becomes
Nk-1 r(i) = SUM x(k) x(k-i-Nd) . k=0
If the coefficient matrix is numerically not positive definite, or if the error energy becomes negative at some stage in the calculation, the remaining filter coefficients are set to zero.