I want to learn how to compute linear coefficient, but to be honest - I can't. I know how to use them if i have it and why I want them.

Suppose this toy example:

A signal $x=[-1, -2, 0, 1]$

According to matlab function lpc(X,p) if I want to compute the 2th order coefficients of this signal the result is $a = [1.0, -0.50, 0.50]$ and $ g=1.0$

I Know how to compute the g using $A(k)$ formula and that $a_0=1$ always, but can someone explain me why $a_1=-0.5, a_2=0.5$ how to compute them without using matlab or any other software.

P.S It there any method which allow me using $A(k)$ to compute directly the coefficients?



1 Answer 1


First you need to compute the signal's autocorrelation:

$$R(k)=\sum_nx(n)x(n+k),\quad k=0,1,\ldots,p$$

In your case with $p=2$ you get

$$\begin{align}R(0)&=(-1)(-1)+(-2)(-2)+0\cdot 0+1\cdot 1=6\\ R(1)&=(-1)(-2)+(-2)\cdot 0+0\cdot 1=2\\ R(2)&=(-1)\cdot 0+(-2)\cdot 1=-2\end{align}$$

Then you have to solve a system of linear equations:

$$\begin{bmatrix}R(0)&R(1)\\ R(1)&R(0)\\ \end{bmatrix} \begin{bmatrix}a_1\\a_2\end{bmatrix}= -\begin{bmatrix}R(1)\\R(2)\end{bmatrix}$$

which gives the values $a_1=-0.5$ and $a_2=0.5$. Of course $a_0=1$, as you've already noted.

The matrix that occurs in the system of linear equations is a Toeplitz matrix, i.e. all its diagonals have the same elements. As a result, such systems can be solved by specialized and efficient algorithms, such as Levinson's algorithm.

  • $\begingroup$ I get it. One more question: the $A(k)= \frac{1}{N} \sum_{ k}^{N-1}\left \|x(n)-x(n-1) \right \| $ which I compute (matlab called it $g$)what exactly is(are you use it?) and what's your method name? $\endgroup$
    – Eric P.
    Jun 14, 2015 at 12:04
  • $\begingroup$ @EricP.: I just used the definition of the LPC coefficients; that's not really a "method". The various methods usually differ in the way they solve the system of equations. As mentioned in my answer, one popular method is Levinson's algorithm. The value $g$ is the variance of the prediction error, and it can be computed as $R_0+a_1R_1+a_2R_2=4$ (so it's not $1$). $\endgroup$
    – Matt L.
    Jun 14, 2015 at 13:50
  • $\begingroup$ Matt L. for the above signal $X=[-1, -2 ,0,1]$ if you press $[a,g] = lpc(X,2)$ as the result you get $g=1.0$ $\endgroup$
    – Eric P.
    Jun 14, 2015 at 14:11
  • $\begingroup$ @EricP.: OK, then you have to figure out what Matlab means by $g$, it can't be the error variance then. $\endgroup$
    – Matt L.
    Jun 14, 2015 at 14:38
  • $\begingroup$ According to mathworks site, $g$ is the prediction error variance. link $\endgroup$
    – Eric P.
    Jun 14, 2015 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.