% Hnew=par_binconv(H,m) % Converts parity matrix H of size 1xn (corresponding to (n-1)/n % convolutional codes), with elements expressed in octal form, % into matrix Hnew. The new matrix has size 1x(n(m+1)), where % the elements are binary values. Every m+1 elements correspond to % the binary description of the original element of H expressed in octal % form. The argument m is the maximum degree of the polynomials of % H (and is equal to the log2 the number of states of the (n-1)/n code). % Note that the ordering of the binary entries of Hnew is LSB to MSB. % % George Ginis, June 2001 function Hnew=par_binconv(H,m) n=size(H,2); % determine rate of code from dimensions of parity matrix if (size(H,1) ~= 1) disp('Code does not have rate (n-1)/n!'); break; end k=n-1; % matrix defining mapping from octal values to binary values map=[0 0 0; 1 0 0; 0 1 0; 1 1 0; 0 0 1; 1 0 1; 0 1 1; 1 1 1]; for j=1:n % for all columns % each entry of H has at most ceil((m+1)/3) octal digits for digit=0:ceil((m+1)/3)-1 r = mod(H(1,j),10); H(1,j) = floor(H(1,j)/10); % each digit corresponds to 3 binary entries, unless the % maximum number of binary entries has been reached if (digit*3+3 <= m+1) Hnew(1,(j-1)*(m+1)+digit*3+1:(j-1)*(m+1)+digit*3+3) = map(r+1,:); else Hnew(1,(j-1)*(m+1)+digit*3+1:(j-1)*(m+1)+(m+1)) = ... map(r+1,1:m-digit*3+1); end end end