%CODIFICADOR DE LOS LAR.
%function LARc=larcod(LAR)
%Entradas:
%LAR:Log-Area-Ratios.
%Salidas:
%LARc:LAR codificados.
function LARc=larcod(LAR)
A=[20 20 20 20 13.637 15 8.334 8.824];
B=[0 0 4 -5 0.184 -3.5 -0.666 2.235];
MAC=[31 31 15 15 7 7 3 3];
MIN=[-32 -32 -16 -16 -8 -8 -4 -4];
for i=1:8;
   LARc(i)=round(A(i)*LAR(i)+B(i));
end
for i=1:8
	if(LARc(i)<MIN(i))
   	LARc(i)=MIN(i);
	elseif(LARc(i)>MAC(i))
   	LARc(i)=MAC(i);
	end
end