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.

rsprp.m
%Primitive Polynomial
%pp=[1 1 1];
%pp=[1 0 1 1];
%pp=[1 0 0 1 1];
%pp=[1 0 0 1 0 1];
%pp=[1 0 0 0 0 1 1];
%pp=[1 0 0 0 1 0 0 1];
pp=[1 0 0 0 1 1 1 0 1];
m=length(pp)-1;
bpr=zeros(2^m,m+1);
%Binary presentation
%Up to mth power
for i=2:m+1
    bpr(i,m+3-i)=1;
end
%Larger than mth power
for i=m+2:2^m
    for j=1:m
        bpr(i,j)=bpr(i-1,j+1);
    end
    bpr(i,m+1)=0;
    if bpr(i,1)==1
        bpr(i,:)=xor(bpr(i,:),pp);
    end
end
%Binary to decimal
b2d=zeros(2^m,1);
for i=1:2^m
    for j=1:m
    b2d(i)=b2d(i)+bpr(i,j+1)*2^(m-j);
    end
end
%Log table
[xx,ppr]=sort(b2d(2:2^m));
ppr=ppr-1;
%Inverse log table
dpr=b2d(3:2^m);


    

Contact us