%CÓDIGO CÍCLICO. %function p=crc5350(Ia) %Entradas: %Ia:50 bits de la clase Ia, la de mayor importancia. %Salidas: %p:tres bits de paridad. function p=crc5350(Ia) r=[0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 0 0;0 1 1;1 0 0;1 0 0;0 0 1;0 0 1;1 1 1;1 1 0]; r=[r;0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 1 0;0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 1 0]; r=[r;0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 1 0;0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 1 0]; r=[r;0 1 1;1 0 0;0 1 0;0 0 1;1 0 1;1 1 1;1 1 0;0 1 1]; b=diag(ones(1,50),0); for i=1:50 for j=1:3 b(i,j+50)=r(i,j); end end paux=Ia*b; paux=mod(paux,2); p=[paux(51),paux(52),paux(53)]; p=dec2bin(p,1)';