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.

PLNmodel.m
psize=2049;
nsub=500;
perc=0.5;
f=[0:psize-1]/2048*50e6;
f(1)=0.00001;
%define shortwave radio bands
mask1l=5.5e6;
mask1h=6e6;
mask2l=7e6;
mask2h=7.5e6;
mask3l=9e6;
mask3h=9.8e6;
mask4l=11.5e6;
mask4h=12e6;
mask5l=13.5e6;
mask5h=14e6;
mask6l=14.8e6;
mask6h=15e6;
mask7l=17.5e6;
mask7h=18e6;
mask8l=21.5e6;
mask8h=21.8e6;
%define 30 random peaks
rloc1=rand(1,30)*50e6;
rloc2=rand(1,30)*50e6;
rloc3=rand(1,30)*50e6;
rloc4=rand(1,30)*50e6;
rloc5=rand(1,30)*50e6;
rloc6=rand(1,30)*50e6;
rloc7=rand(1,30)*50e6;
rloc8=rand(1,30)*50e6;
rloc9=rand(1,30)*50e6;
rloc10=rand(1,30)*50e6;
%noise floor
nsfllog=-145;
nsflflog=ones(1,psize)*nsfllog;
nsflf=10.^(nsflflog/10);
%radio background noise level, e-filed
efildlog=34.5-20;
efildflog=ones(1,psize)*efildlog;
epowflog=efildflog-149.5;
epowf=10.^(epowflog/10);
%radio interference noise level, random e-field
erfildflog=rand(1,psize)*65;
%spectrum mask
erfmask=ones(1,psize)*0.1;
for i=1:psize
if f(i)>mask1l & f(i)<mask1h
erfmask(i)=1;
end
if f(i)>mask2l & f(i)<mask2h
erfmask(i)=1;
end
if f(i)>mask3l & f(i)<mask3h
erfmask(i)=1;
end
if f(i)>mask4l & f(i)<mask4h
erfmask(i)=1;
end
if f(i)>mask5l & f(i)<mask5h
erfmask(i)=1;
end
if f(i)>mask6l & f(i)<mask6h
erfmask(i)=1;
end
if f(i)>mask7l & f(i)<mask7h
erfmask(i)=1;
end
if f(i)>mask8l & f(i)<mask8h
erfmask(i)=1;
end
for j=1:30
if f(i)>rloc1(j)-100e3 & f(i)<rloc1(j)+100e3
erfmask(i)=0.2;
end
if f(i)>rloc2(j)-100e3 & f(i)<rloc2(j)+100e3
erfmask(i)=0.3;
end
if f(i)>rloc3(j)-100e3 & f(i)<rloc3(j)+100e3
erfmask(i)=0.4;
end
if f(i)>rloc4(j)-100e3 & f(i)<rloc4(j)+100e3
erfmask(i)=0.5;
end
if f(i)>rloc5(j)-100e3 & f(i)<rloc5(j)+100e3
erfmask(i)=0.6;
end
if f(i)>rloc6(j)-100e3 & f(i)<rloc6(j)+100e3
erfmask(i)=0.7;
end
if f(i)>rloc7(j)-100e3 & f(i)<rloc7(j)+100e3
erfmask(i)=0.8;
end
if f(i)>rloc8(j)-100e3 & f(i)<rloc8(j)+100e3
erfmask(i)=0.9;
end
end
end
erfildflog=erfildflog.*erfmask;
%conversion at 10 MHz
erpowflog=erfildflog-149.5;
erpowf=10.^(erpowflog/10);
%sum of background and interference noise power
epowf=epowf+erpowf;
%field to power: propotional to the power of wavelength
epowf=epowf.*(5e6./f).^2;
epowft=perc*epowf+nsflf;
f(1)=0;
nfilt=fir2(900,f/max(f),sqrt(epowft));
[h,w]=freqz(nfilt,1,1024);
px=[1:1024]/1024*50e6;
py=20*log10(abs(h));
plot(px(10:1024),py(10:1024),'k');
grid
xlabel('Frequency (Hz)')
ylabel('Noise Level (dBm/Hz)')

Contact us