function aq = larpredq( a, larmax, larbits )
% function aq = larpredq( a, larmax, larbits )
%
% Simulation of Log-Area-Ratio Predictor-Coefficients Quantizer 
%
% a:       input vector to be quantized
% larmax:  maximum LAR (2 ... 5 )
% larbits: number of bits per LAR   
% aq:      quantized approximation of a
%
% Author:  Markus Hauenstein
% Date:    31.12.2001
% Contact: www.markus-hauenstein.de

N = length(a);
if N ~= length(larbits),
  error( 'larpredq: a and larbits do not have the same size' );
end

r = a2r( a );
lar = log( (1-r)./(1+r) );

larq = zeros(N,1);
for i=1:N,
  larq(i) = linquant( lar(i), larmax, larbits(i) );
end

rq = (1-exp(larq)) ./ (1+exp(larq));
aq = r2a( rq );
