function [C] = tf2ceps(A, N)
% [C] = tf2ceps(A, N)
% 
% Calculate the first N cepstral coefficients
% corresponding to the LPC coefficients in A.
%
% C(1) = C(1) really, not C(0); 
% If you want C(0), it's just log G (complex)
% or log G^2 (power cepstrum).
%

C = zeros(1, N);

% Shift down, multiply by -1 so that A(i) = a_i
A = -A(2:length(A));
A = [A zeros(1,N-length(A))];

for m=1:N,
  C(m) = A(m) + sum([1:(m-1)] .* C(1:(m-1)) .* A((m-1):-1:1)) / m;
end;
