I want to test my understanding of linear prediction by running it on some test data in MATLAB. The way I understand it is if I have some data that is correlated, I can encode the signal with linear prediction as follows: $$x(n) = \sum_{i=1}^{p} a(i) x(n-i) + \epsilon(n)$$ where $[a(i)..... a(p)]$ are the coefficients of the AR model of $x(n)$ and $\epsilon(n)$ is a zero-mean white noise process. Thus, the signal is completely determined by its coefficients and the variance of $\epsilon(n)$.

Here's my code for generating the coefficients and variance (sorry I couldn't figure out how to get code in with rest of text):

I'm confused about the decoder side however. I now have my prediction coefficients and my error variance, but don't quite know what to do with them. Is it as simple as creating white noise with the variance that was encoded, and then passing it through the inverse filter with the coefficients encoded? Or is there something else I'm missing?

  • 2
    $\begingroup$ Hi! The signal $x[n]$ is not completely determined by those $a_p[k]$ and the variance of white noise $\epsilon [n]$; you need all samples of $\epsilon [n]$ to completely specify the signal $x[n]$. What are determined by those parameters are its power spectrum $P_x(\omega)$ and its autocorrelation sequence $r_x[k]$ values. But the actual values of $x[n]$ (if that's important for any reason) is dependent on the whole set of $\epsilon [n]$. $\endgroup$ – Fat32 Nov 14 '18 at 19:08
  • $\begingroup$ You can copy/paste the code and apply the preformatting denoted be the {} icon. $\endgroup$ – Laurent Duval Nov 14 '18 at 20:33
  • $\begingroup$ @Fat32 Thanks for your quick reply! That makes total sense. So is there a way then, to approximate the signal $x[n]$ by the prediction coefficients and the variance of white noise? $\endgroup$ – compscinoob Nov 15 '18 at 0:26
  • $\begingroup$ that's ok you are already predicting that signal $x[n]$ from its past values indicated by the recursive summation, within a prediction error indicated by $\epsilon [n]$... $\endgroup$ – Fat32 Nov 15 '18 at 10:39
  • $\begingroup$ Right but I don't understand where the encoding comes in. Wouldn't I not be achieving any compression since I have to encode the past values along with the coefficients? Everywhere I've seen seems to only mention encoding the coefficients along with the variance of $\epsilon[n]$. $\endgroup$ – compscinoob Nov 15 '18 at 11:11

Your Answer

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

Browse other questions tagged or ask your own question.