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.

cc64.m
% Matlab code to produce the 0 phase version of
% length 8 complementary code set
% Set up data bits matrix
db=zeros(64,6);
db(2,6)=1;
for i=1:2
    db(i+2,6)=db(i,6);
    db(i+2,5)=1;
end
for i=1:4
    db(i+4,5:6)=db(i,5:6);
    db(i+4,4)=1;
end
for i=1:8
    db(i+8,4:6)=db(i,4:6);
    db(i+8,3)=1;
end
for i=1:16
    db(i+16,3:6)=db(i,3:6);
    db(i+16,2)=1;
end
for i=1:32
    db(i+32,2:6)=db(i,2:6);
    db(i+32,1)=1;
end
% Set up imaginary number and phase table
jj=sqrt(-1);
b2p=[0 pi/2 pi 3*pi/2];
% Form code words
for i=1:64
    p1=b2p(1+db(i,1)+2*db(i,2));
    p2=b2p(1+db(i,3)+2*db(i,4));
    p3=b2p(1+db(i,5)+2*db(i,6));
    p1a=p1/pi*2;
    p2a=p2/pi*2;
    p3a=p3/pi*2;
    cc(i,1)=exp(jj*(p1+p2+p3));
    cc(i,2)=exp(jj*(p2+p3));
    cc(i,3)=exp(jj*(p1+p3));
    cc(i,4)=-exp(jj*(p3));
    cc(i,5)=exp(jj*(p1+p2));
    cc(i,6)=exp(jj*(p2));
    cc(i,7)=-exp(jj*(p1));
    cc(i,8)=1;
    ca(i,1)=mod(p1a+p2a+p3a,4);
    ca(i,2)=mod(p2a+p3a,4);
    ca(i,3)=mod(p1a+p3a,4);
    ca(i,4)=mod(p3a+2,4);
    ca(i,5)=mod(p1a+p2a,4);
    ca(i,6)=mod(p2a,4);
    ca(i,7)=mod(p1a+2,4);
    ca(i,8)=0;
end

Contact us