From 9ca7882cee16ad48b18df989e8300c697010e55a Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Wed, 25 Jul 2018 16:27:51 +0530 Subject: code changes by Sonu Sharma during FOSSEE Fellowship 2018 --- help/en_US/lpc.xml | 67 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 20 deletions(-) (limited to 'help/en_US/lpc.xml') diff --git a/help/en_US/lpc.xml b/help/en_US/lpc.xml index 1ebe531..079923e 100644 --- a/help/en_US/lpc.xml +++ b/help/en_US/lpc.xml @@ -18,6 +18,7 @@ lpc Linear prediction filter coefficients + @@ -26,9 +27,8 @@ [a,g] = lpc(x) [a,g] = lpc(x,p) - - + @@ -36,44 +36,71 @@ [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. +filter by minimizing the squared error. If p is unspecified, a +default value of length(x)-1 is used. - - + Parameters x: - double + doubleinput signal, if it is a matrix each column is computed independently p: - int, natural number, scalar + int, natural number, scalarorder of linear predictor filter, value must be scalar, positive and must be less than or equal to length of input signal a: - double + doublecoefficient of forward linear predictor, coefficient for each signal input is returned as a row vector g: - double + doubleColumn vector of averaged square prediction error + + Description + This function determines coefficients of a forward linear predictor by minimizing prediction error in least squares sense. It is used in Digital Filter Design + + + Examples - -References -[1] Hayes, Monson H. Statistical digital signal processing and modeling. -John Wiley & Sons, 2009, pg. 220 + +noise = rand(50000,1,"normal"); //Gaussian White Noise +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'); + + - ]]> + See also -- cgit