Main Content

Linear prediction filter coefficients

`[`

finds the coefficients of a `a`

,`g`

] = lpc(`x`

,`p`

)`p`

th-order linear predictor, an FIR filter
that predicts the current value of the real-valued time series `x`

based
on past samples. The function also returns `g`

, the variance of the
prediction error. If `x`

is a matrix, the function treats each column as
an independent channel.

`lpc`

determines the coefficients of a forward linear predictor by
minimizing the prediction error in the least squares sense. It has applications in filter
design and speech coding.

`lpc`

uses the autocorrelation method of autoregressive (AR) modeling
to find the filter coefficients. The generated filter might not model the process exactly,
even if the data sequence is truly an AR process of the correct order, because the
autocorrelation method implicitly windows the data. In other words, the method assumes that
signal samples beyond the length of `x`

are 0.

`lpc`

computes the least-squares solution to *X**a* = *b*, where

$$\begin{array}{ccc}X=\left[\begin{array}{cccc}x(1)& 0& \cdots & 0\\ x(2)& x(1)& \cdots & \vdots \\ \vdots & x(2)& \cdots & 0\\ x(m)& \vdots & \vdots & x(1)\\ 0& x(m)& \cdots & x(2)\\ \vdots & \vdots & \vdots & \vdots \\ 0& \cdots & 0& x(m)\end{array}\right],& a=\left[\begin{array}{c}1\\ a(2)\\ \vdots \\ a(p+1)\end{array}\right],& b=\left[\begin{array}{c}1\\ 0\\ \vdots \\ 0\end{array}\right]\end{array},$$

and *m* is the length of *x*. Solving the least-squares
problem using the normal equations $${X}^{H}Xa={X}^{H}b$$ leads to the Yule-Walker equations

$$\left[\begin{array}{cccc}r(1)& r{(2)}^{\ast}& \cdots & r{(p)}^{\ast}\\ r(2)& r(1)& \cdots & \vdots \\ \vdots & \vdots & \ddots & r{(2)}^{\ast}\\ r(p)& \cdots & r(2)& r(1)\end{array}\right]\left[\begin{array}{c}a(2)\\ a(3)\\ \vdots \\ a(p+1)\end{array}\right]=\left[\begin{array}{c}-r(2)\\ -r(3)\\ \vdots \\ -r(p+1)\end{array}\right],$$

where *r*```
=
[
```

*r*(1) *r*(2) ... *r*(*p*+1)`]`

is an autocorrelation estimate for `x`

computed using `xcorr`

. The
Levinson-Durbin algorithm (see `levinson`

) solves the Yule-Walker equations in *O*(*p*^{2}) flops.

[1] Jackson, L. B. *Digital
Filters and Signal Processing*. 2nd Edition. Boston: Kluwer Academic Publishers,
1989, pp. 255–257.