LPC Coefficients for Digital Filter

Discussion in 'Wireless & RF Design' started by Alice, Jun 24, 2009.

  1. Alice

    Thread Starter New Member

    Mar 29, 2008
    Hi, I'm doing some speech processing using Linear Predictive Coding, and I'm trying to use MATLAB to find the feedback coefficients, ai, for a digital filter of the form

    y[n] = x[n] + Ʃ(ai * y[n-i])

    (sum goes form i = 1 to i = N where N is the order of the filter)

    where n is the index of the sample point, y[n] is the output, x[n] is a pulse input with period equal to the pitch period of the speech segment, and the y[n-i] are the past outputs. I'm pretty sure the feedforward coefficients in this case should be b = [1 0 0 0....0] of length N +1, so I ignore them in the formula.

    I wrote a program which will solve for the ai's by simply looping through and plugging in each value of y[n], a 0 for x[n] and the previous values for y[n], but now I'm confused:

    Once I solve for my ai's, I can plug them back in and get my vector y[n], since that's what I used to solve for the coefficients in the first place... but when I use the filter function in MATLAB

    y = filter(b,a,x(n));

    where x(n) is the pulse input, I thought y should be equal or at least close to my original output vector y[n], but it isn't. Also, when I use the freqz function

    [H,F] = freqz(b,a,# of points,sampling frequency);

    The plot does not look like the frequency spectrum of the original signal, and does not get better as I increase the order of the filter. When I use the built-in MATLAB function

    a = lpc(y,N) (where N is again the filter order)

    I get coefficients that are nothing like the ones I found, and when I use the filter function on them, the y is nothing like the original y[n]. However, the plot of the spectral envelope looks just like it should, so obviously the coefficients are correct.

    I know the built-in lpc function is using the autocorrelation method, but I don't understand why my method of finding the coefficients isn't working!

    I must be missing something, as I'm very new to signal processing. Could you please help me figure out what I'm doing wrong? Why am I not getting the right results by simply plug in present output, present pulse input and past outputs to solve for the coefficients?

    Any help would be very much appreciated! Sorry this is so long.

    Thanks! Alice.
  2. Mathematics!

    Senior Member

    Jul 21, 2008
    Sorry but maybe I would beable to help if the question was more clearly written.y[n] = x[n] + Ʃ(ai * y[n-i]) whats the square ???Anyway maybe this link would help http://en.wikipedia.org/wiki/Digital_filterI am just wondering your not a graduate student at UMASS in Mathematics are you?Because if you are Allison T then I know somebody that really really likes you.And thinks your very beutiful Anyway hope you get your answer.