<< levinson | FOSSEE_Signal_Processing_Toolbox | lsf2poly >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > lpc

# lpc

Linear prediction filter coefficients

### Syntax

    [a,g] = lpc(x)
    [a,g] = lpc(x,p)

### Description

[a,g] = lpc(x,p) Determines the coefficients of a pth order forward linear predictor filter by minimizing the squared error. If p is unspecified, a default value of length(x)-1 is used.

### Parameters

x:

  double

p:

  int, natural number, scalar

a:

  double

g:

  double

### Examples

    noise = rand(50000,1,"normal");
    x = filter(1,[1 1/2 1/3 1/4],noise);
    x = x(45904:50000);
    [a,g]= lpc(x,3)
    est_x = filter([0 -a(2:$)],1,x);
    e = x-est_x;
    [acs,lags] = xcorr(e,'coeff');
    plot(1:97,x(4001:4097),1:97,est_x(4001:4097),'--');
    a = gca();
    a.grid = [1,1];
    title('Original Signal vs. LPC Estimate');
    xlabel ('Sample number', ylabel 'Amplitude');
    legend('Original signal','LPC estimate');

### Bibliography

[1] Hayes, Monson H. Statistical digital signal processing and modeling.

John Wiley & Sons, 2009, pg. 220

### See also

- | levinson | prony | pyulear | stmcb — Fit an AR (p)-model with Yule-Walker estimates.

### Authors

- Ayush Baid

Report an issue
<< levinson | FOSSEE_Signal_Processing_Toolbox | lsf2poly >>