function C=a_to_cepst(A,NBC); % COnversion of LPC coefficints to LPC cepstra % % Syntax: C=a_to_cepst(A) % or C=a_to_cepst(A,NBC) % % A is matrix with a vector of P+1 LPC coefficients n each column (including % a0=1): [1 a(1) a(2) ... a(P)]' % NBC is the desired number of LPCC coefficients without c0. (default P) % C is the matrix with vector of LPCC coefficients (without c0) in each % column: [c(1) c(2) ... c(NBC)]' [P_1, Nram] = size(A); P=P_1 - 1; if nargin==1, NBC=P; end C=zeros(NBC, Nram); for ii=1:Nram, a=A(:,ii); c=zeros(NBC,1); % initialization of cps vector ahelp=[a; zeros(NBC-length(a)+1,1)]; % "prolongation" of a c(1)=-ahelp(2); for n=2:NBC, divis=(1:n-1)/n; som=divis*(c(1:(n-1)).*ahelp(n:-1:2)); % "vectorised" sum c(n)=-ahelp(n+1)-som; end % one vector ready C(:,ii) = c; end % all vectors ready