No BSD License  

Highlights from
Home Networking Basis

Home Networking Basis

by

 

11 Aug 2003 (Updated )

M-files for chapters 2-10 and Simulink models for Ethernet and Wireless Ethernet.

rscoder.m
%GF size
n=8;
%Random bits
mx=ceil(rand(8,239)-0.5);
%Initialize code words
cw=zeros(8,16);
%Get generator polynomial
gpoly
%Encoding
for i=1:239
    %Calculate register feedback value
    rf=xor(cw(:,1),mx(:,i));
    if sum(rf)>0
        %Power representation
        prf=b2pw8(rf,n,ppr);
        for j=1:15
            cw(:,j)=xor(p2bin8(gp(j+1)+prf,n,bpr),cw(:,j+1));
        end
        cw(:,16)=p2bin8(gp(17)+prf,n,bpr);
    else
        for j=1:15
            cw(:,j)=cw(:,j+1);
        end
        cw(:,16)=zeros(8,1);
    end
end
%Find the power form
for i=1:239
    mxp(i)=b2pw8(mx(:,i),8,ppr);
end
for i=1:16
    cwp(i)=b2pw8(cw(:,i),8,ppr);
end
cwp

Contact us