www.pudn.com > LPCToolbox.rar > PARCOR.M


% [a,k,g] = parcor(h,N) 
%   h : data sequence 
%   N : order of prediction filter 
%   a : prediction coefficiens 
%   k : reflection coefficients  
%   g : gain 
% 
% Partial Correlation Coefficients (also called reflection coefficients).  
% See Rabiner & Schafer, 1978, section 8.3.2, and Markel & Gray, 1976, 
% sectios 6.2.1,2,5 
% 
% N.B: There is some confusion over the signs of partial correlation 
% (PARCOR) coeffs and reflection coeffs. PARCOR coeffs are the negative 
% of the true autocorrelation coeffs, and the reflection coeffs returned 
% by LEVINSON & POLY2RC follow this convention.  
% 
function [a,k,g] = parcor(h,N) 
 
[r,c] = size(h); 
if (c>1)&(r==1), h = h(:); end 
 
% R is the autocorrelation vector.   
R = xcorr(h); 
M = length(h); 
R(1:M-1) = []; 
 
% Durbin Recursion 
 
a = levinson(R,N); 
g = sqrt(real( sum((a').*R(1:N+1,:)))); 
k = poly2rc(a);