# Home Networking Basis

### Walter Chen (view profile)

11 Aug 2003 (Updated )

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

```ModelType='LOS';
%Separation distance Eexpressed in meet
Dn=5;
switch ModelType
% For line-of-sight
case 'LOS'
% Probability of receiving a multipath
for i=1:14
PTk(i)=1-i*7.8/367;
end
for i=15:25
PTk(i)=0.65-(i*7.8-110)/360;
end
for i=26:64
PTk(i)=0.22-(i*7.8-200)/1360;
end
% Delay related path loss exponent
for i=1:2
nTk(i)=2.5+i*7.8/39;
end
for i=3:32
nTk(i)=3+(i*7.8-15.6)/380;
end
for i=33:64
nTk(i)=3.6;
end
% Mean
mean1=10*nTk*log10(Dn/2.3);
% Standard Deviation
std1=4;
case 'OBS'
% Probability of receiving a multipath
for i=1:12
PTk(i)=0.55+i*7.8/667;
end
for i=13:64
PTk(i)=0.08+0.62*exp(-(i*7.8-100)/75);
end
% Delay related path loss exponent
for i=1:39
nTk(i)=3.65+i*7.8/536;
end
for i=40:64
nTk(i)=4.23;
end
% Mean
mean1=10*nTk*log10(Dn/2.3);
% Standard Deviation
std1=5;
otherwise

end
OcTk=ceil(PTk-rand(1,64));
Ak1=zeros(1,64);
Ak0=rand(1,64)*std1+mean1;
for i=1:64
if OcTk(i)==1
Ak1(i)=Ak0(i);
end
end
ak1=zeros(1,64);
for i=1:64
if OcTk(i)==1
ak1(i)=10^(-Ak1(i)/20);
end
end
figure(1)
plot([1:64],ak1/max(ak1),'k')
xlabel('Excess Delay (ns)')
ylabel('Channel Index')
%raised cosie pulse
alp=0.15;
xt=[-385:385]/64;
gt=sin(pi*xt)./(pi.*xt).*cos(alp.*pi.*xt)./(1-(2.*alp.*xt).^2);
gt(386)=1;
figure(2)
plot(xt,gt)
gtchnl=zeros(1,834);
for i=1:64
gtchnl(i:i+770)=ak1(i).*cos(2*pi*2.4e9*(i-1)*7.8e-9)*gt+gtchnl(i:i+770);
end
figure(3)
plot(gtchnl)
maxgtchnl=max(gtchnl);
mingtchnl=min(gtchnl);
if maxgtchnl>-mingtchnl
gtchnl=gtchnl/maxgtchnl;
else
gtchnl=gtchnl/mingtchnl;
end
for i=1:834
if gtchnl(i)==1;
maxj=i;
end
end
xtgtchnl=([1:834]-maxj)/64;
figure(4)
plot(xt,gt,'k',xtgtchnl,gtchnl,'k')
grid
xlabel('Symbol Interval')
ylabel('Magnitude')```