Home Networking Basis: Transmission Environments and Wired/Wireless Protocols

The following MATLAB files should allow readers to re-create some of the solutions in this chapter. These files can also be customized to solve variations problems that a reader might later encounter.

2.6.1 Parametric Model to RLGC

function [r,l,g,c]=RLGCExpQ22(f); r0c=406.65; ac=0.2643; l0=1.229; linf=0.927; fm=386e3; b=0.794; g0=0.0432; ge=0.8805; cinf=0.071; c0=0.121; ce=0.245; r=sqrt(sqrt(r0c^4+ac.*f.^2)); l=(l0+linf*(f./fm).^b)./(1+(f./fm).^b); g=g0.*f.^ge; c=cinf+c0.*f.^(-ce);

2.6.2 RLGC to ABCD Parameters

function [a,b,c,d]=abcd(f,r,l,g,d); jw=(j*2*pi).*f'; rf=interp1(r(:,1),r(:,2),f,'spline'); lf=interp1(l(:,1),l(:,2),f,'spline'); gf=interp1(g(:,1),g(:,2),f,'spline'); cf=0.083*ones(length(f),1); gamma=((rf+jw.*lf*1e-3).*(gf*1e-6+jw.*cf*1e-6)).^0.5; z=((rf+jw.*lf*1e-3)./(gf*1e-6+jw.*cf*1e-6)).^0.5; gammad=gamma*d/5280; a=cosh(gammad); sinhg=sinh(gammad); b=z.*sinhg; c=sinhg./z; d=a;

2.6.3 Insertion Loss Calculation

function [ht,h]=abcd2h(a,b,c,d); r=100; sz=length(a); h=2*r*ones(sz,1)./(r*(c*r+d)+a*r+b); phs=unwrap(angle(h)); phsjt=round(phs(sz)/pi); phslt=phs(sz-250); phs=[phs(1:sz-250)' spline([sz-250 sz],[phslt phsjt*pi],[sz-250+1:sz])]'; hma=abs(h).*exp(j*phs); h(1:sz)=real(hma(1:sz))+sqrt(-1)*imag(hma(1:sz)); h(sz+1:2*sz-1)=real(hma(sz:-1:2))-sqrt(-1)*imag(hma(sz:-1:2)); ht=real(ifft(h);

2.6.4 Channel Capacity against Background White Noise

f=[1:1025]/1025*15e6; df=max(f)/1024; psd1=-40; psd2=-47.5; psd3=-54.4; psd4=-57.5; psdwn=-140; lpsdwn=10^(-140/10); d=100/0.3048; a3=8.17e-7; b3=8.07e-11; a4=7.37e-7; b4=9.12e-12; a5=7.26e-7; b5=4.56e-12; aq=6.77e-7; bq=4.97e-11; af=9.17e-7; bf=4.87e-11; he3=-(a3.*sqrt(f)+b3.*f).*328.*8.686; he4=-(a4.*sqrt(f)+b4.*f).*328.*8.686; he5=-(a5.*sqrt(f)+b5.*f).*328.*8.686; heq=-(aq.*sqrt(f)+bq.*f).*328.*8.686; hef=-(af.*sqrt(f)+bf.*f).*328.*8.686; %Category 3 Sd1e3=10.^((psd1+he3)./10); Sd2e3=10.^((psd2+he3)./10); Sd3e3=10.^((psd3+he3)./10); Sd4e3=10.^((psd4+he3)./10); %Category 4 Sd1e4=10.^((psd1+he4)./10); Sd2e4=10.^((psd2+he4)./10); Sd3e4=10.^((psd3+he4)./10); Sd4e4=10.^((psd4+he4)./10); %Category 5 Sd1e5=10.^((psd1+he5)./10); Sd2e5=10.^((psd2+he5)./10); Sd3e5=10.^((psd3+he5)./10); Sd4e5=10.^((psd4+he5)./10); % Quad-22 Sd1eq=10.^((psd1+heq)./10); Sd2eq=10.^((psd2+heq)./10); Sd3eq=10.^((psd3+heq)./10); Sd4eq=10.^((psd4+heq)./10); % FW-26 Sd1ef=10.^((psd1+hef)./10); Sd2ef=10.^((psd2+hef)./10); Sd3ef=10.^((psd3+hef)./10); Sd4ef=10.^((psd4+hef)./10); figure(2) plot(f,he3,'k',f,he4,'k',f,he5,'k',f,heq,'k',f,hef,'k') %plot(f,he3,f,he4,f,he5,f,heq,f,hef,f,20*log10(abs(hq(1:1025))),f,20* log10(abs(hf(1:1025)))) grid xlabel('Frequency (Hz)') ylabel('Insertion Loss (dB)') figure(3) %Category 3 Cd0e3=9000*log2(1+Sd1e3/lpsdwn); Cd1e3=zeros(1,1013); fCd1e=f(5:1017); for i=1:1013 for j=i:i+11 Cd1e3(i)=Cd1e3(i)+df*log2(1+Sd1e3(j)/lpsdwn); end end Cd2e3=zeros(1,957); fCd2e=f(34:990); for i=1:957 for j=i:i+67 Cd2e3(i)=Cd2e3(i)+df*log2(1+Sd2e3(j)/lpsdwn); end end Cd3e3=zeros(1,684); fCd3e=f(171:854); for i=1:684 for j=i:i+340 Cd3e3(i)=Cd3e3(i)+df*log2(1+Sd3e3(j)/lpsdwn); end end Cd4e3=zeros(1,343); fCd4e=f(341:683); for i=1:343 for j=i:i+681 Cd4e3(i)=Cd4e3(i)+df*log2(1+Sd4e3(j)/lpsdwn); end end %Category 4 Cd0e4=9000*log2(1+Sd1e4/lpsdwn); Cd1e4=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1e4(i)=Cd1e4(i)+df*log2(1+Sd1e4(j)/lpsdwn); end end Cd2e4=zeros(1,957); for i=1:957 for j=i:i+67 Cd2e4(i)=Cd2e4(i)+df*log2(1+Sd2e4(j)/lpsdwn); end end Cd3e4=zeros(1,684); for i=1:684 for j=i:i+340 Cd3e4(i)=Cd3e4(i)+df*log2(1+Sd3e4(j)/lpsdwn); end end Cd4e4=zeros(1,343); for i=1:343 for j=i:i+681 Cd4e4(i)=Cd4e4(i)+df*log2(1+Sd4e4(j)/lpsdwn); end end %Category 5 Cd0e5=9000*log2(1+Sd1e5/lpsdwn); Cd1e5=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1e5(i)=Cd1e5(i)+df*log2(1+Sd1e5(j)/lpsdwn); end end Cd2e5=zeros(1,957); for i=1:957 for j=i:i+67 Cd2e5(i)=Cd2e5(i)+df*log2(1+Sd2e5(j)/lpsdwn); end end Cd3e5=zeros(1,684); for i=1:684 for j=i:i+340 Cd3e5(i)=Cd3e5(i)+df*log2(1+Sd3e5(j)/lpsdwn); end end Cd4e5=zeros(1,343); for i=1:343 for j=i:i+681 Cd4e5(i)=Cd4e5(i)+df*log2(1+Sd4e5(j)/lpsdwn); end end %Quad 22 Cd0eq=9000*log2(1+Sd1eq/lpsdwn); Cd1eq=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1eq(i)=Cd1eq(i)+df*log2(1+Sd1eq(j)/lpsdwn); end end Cd2eq=zeros(1,957); for i=1:957 for j=i:i+67 Cd2eq(i)=Cd2eq(i)+df*log2(1+Sd2eq(j)/lpsdwn); end end Cd3eq=zeros(1,684); for i=1:684 for j=i:i+340 Cd3eq(i)=Cd3eq(i)+df*log2(1+Sd3eq(j)/lpsdwn); end end Cd4eq=zeros(1,343); for i=1:343 for j=i:i+681 Cd4eq(i)=Cd4eq(i)+df*log2(1+Sd4eq(j)/lpsdwn); end end %FW-26 Cd0ef=9000*log2(1+Sd1ef/lpsdwn); Cd1ef=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1ef(i)=Cd1ef(i)+df*log2(1+Sd1ef(j)/lpsdwn); end end Cd2ef=zeros(1,957); for i=1:957 for j=i:i+67 Cd2ef(i)=Cd2ef(i)+df*log2(1+Sd2ef(j)/lpsdwn); end end Cd3ef=zeros(1,684); for i=1:684 for j=i:i+340 Cd3ef(i)=Cd3ef(i)+df*log2(1+Sd3ef(j)/lpsdwn); end end Cd4ef=zeros(1,343); for i=1:343 for j=i:i+681 Cd4ef(i)=Cd4ef(i)+df*log2(1+Sd4ef(j)/lpsdwn); end end figure(1) plot(f,Cd0e3,'k',f,Cd0e4,'k',f,Cd0e5,'k',f,Cd0eq,'k',f,Cd0ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(2) plot(fCd1e,Cd1e3,'k',fCd1e,Cd1e4,'k',fCd1e,Cd1e5,'k',fCd1e,Cd1eq,'k', fCd1e,Cd1ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(3) plot(fCd2e,Cd2e3,'k',fCd2e,Cd2e4,'k',fCd2e,Cd2e5,'k',fCd2e,Cd2eq,'k', fCd2e,Cd2ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(4) plot(fCd3e,Cd3e3,'k',fCd3e,Cd3e4,'k',fCd3e,Cd3e5,'k',fCd3e,Cd3eq,'k', fCd3e,Cd3ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(5) plot(fCd4e,Cd4e3,'k',fCd4e,Cd4e4,'k',fCd4e,Cd4e5,'k',fCd4e,Cd4eq,'k', fCd4e,Cd4ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)')

2.6.5 Channel Capacity against NEXT Noise

f=[1:1025]/1025*15e6; df=max(f)/1024; hnpw=5.88e-12.*f.^1.5; hn3=7.94e-14.*f.^1.5; hn4=2.51e-15.*f.^1.5; hn5=6.31e-16.*f.^1.5; lpsdwn=10^(-140/10); d=100/0.3048; a3=8.17e-7; b3=8.07e-11; a4=7.37e-7; b4=9.12e-12; a5=7.26e-7; b5=4.56e-12; aq=6.77e-7; bq=4.97e-11; af=9.17e-7; bf=4.87e-11; he3=-(a3.*sqrt(f)+b3.*f).*328.*8.686; he4=-(a4.*sqrt(f)+b4.*f).*328.*8.686; he5=-(a5.*sqrt(f)+b5.*f).*328.*8.686; heq=-(aq.*sqrt(f)+bq.*f).*328.*8.686; hef=-(af.*sqrt(f)+bf.*f).*328.*8.686; %Category 3 S3=10.^(he3./10); %Category 4 S4=10.^(he4./10); %Category 5 S5=10.^(he5./10); % Quad-22 Sq=10.^(heq./10); % FW-26 Sf=10.^(hef./10); %Category 3 Cd0e3=9000*log2(1+S3./hn3); Cd1e3=zeros(1,1013); fCd1e=f(5:1017); for i=1:1013 for j=i:i+11 Cd1e3(i)=Cd1e3(i)+df*log2(1+S3(j)/hn3(j)); end end Cd2e3=zeros(1,957); fCd2e=f(34:990); for i=1:957 for j=i:i+67 Cd2e3(i)=Cd2e3(i)+df*log2(1+S3(j)/hn3(j)); end end Cd3e3=zeros(1,684); fCd3e=f(171:854); for i=1:684 for j=i:i+340 Cd3e3(i)=Cd3e3(i)+df*log2(1+S3(j)/hn3(j)); end end Cd4e3=zeros(1,343); fCd4e=f(341:683); for i=1:343 for j=i:i+681 Cd4e3(i)=Cd4e3(i)+df*log2(1+S3(j)/hn3(j)); end end %Category 4 Cd0e4=9000*log2(1+S4./hn4); Cd1e4=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1e4(i)=Cd1e4(i)+df*log2(1+S4(j)/hn4(j)); end end Cd2e4=zeros(1,957); for i=1:957 for j=i:i+67 Cd2e4(i)=Cd2e4(i)+df*log2(1+S4(j)/hn4(j)); end end Cd3e4=zeros(1,684); for i=1:684 for j=i:i+340 Cd3e4(i)=Cd3e4(i)+df*log2(1+S4(j)/hn4(j)); end end Cd4e4=zeros(1,343); for i=1:343 for j=i:i+681 Cd4e4(i)=Cd4e4(i)+df*log2(1+S4(j)/hn4(j)); end end %Category 5 Cd0e5=9000*log2(1+S5./hn5); Cd1e5=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1e5(i)=Cd1e5(i)+df*log2(1+S5(j)/hn5(j)); end end Cd2e5=zeros(1,957); for i=1:957 for j=i:i+67 Cd2e5(i)=Cd2e5(i)+df*log2(1+S5(j)/hn5(j)); end end Cd3e5=zeros(1,684); for i=1:684 for j=i:i+340 Cd3e5(i)=Cd3e5(i)+df*log2(1+S5(j)/hn5(j)); end end Cd4e5=zeros(1,343); for i=1:343 for j=i:i+681 Cd4e5(i)=Cd4e5(i)+df*log2(1+S5(j)/hn5(j)); end end %Quad 22 Cd0eq=9000*log2(1+Sq./hnpw); Cd1eq=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1eq(i)=Cd1eq(i)+df*log2(1+Sq(j)/hnpw(j)); end end Cd2eq=zeros(1,957); for i=1:957 for j=i:i+67 Cd2eq(i)=Cd2eq(i)+df*log2(1+Sq(j)/hnpw(j)); end end Cd3eq=zeros(1,684); for i=1:684 for j=i:i+340 Cd3eq(i)=Cd3eq(i)+df*log2(1+Sq(j)/hnpw(j)); end end Cd4eq=zeros(1,343); for i=1:343 for j=i:i+681 Cd4eq(i)=Cd4eq(i)+df*log2(1+Sq(j)/hnpw(j)); end end %FW-26 Cd0ef=9000*log2(1+Sf./hnpw); Cd1ef=zeros(1,1013); for i=1:1013 for j=i:i+11 Cd1ef(i)=Cd1ef(i)+df*log2(1+Sf(j)/hnpw(j)); end end Cd2ef=zeros(1,957); for i=1:957 for j=i:i+67 Cd2ef(i)=Cd2ef(i)+df*log2(1+Sf(j)/hnpw(j)); end end Cd3ef=zeros(1,684); for i=1:684 for j=i:i+340 Cd3ef(i)=Cd3ef(i)+df*log2(1+Sf(j)/hnpw(j)); end end Cd4ef=zeros(1,343); for i=1:343 for j=i:i+681 Cd4ef(i)=Cd4ef(i)+df*log2(1+Sf(j)/hnpw(j)); end end figure(1) plot(f,Cd0e3,'k',f,Cd0e4,'k',f,Cd0e5,'k',f,Cd0eq,'k',f,Cd0ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(2) plot(fCd1e,Cd1e3,'k',fCd1e,Cd1e4,'k',fCd1e,Cd1e5,'k',fCd1e,Cd1eq,'k', fCd1e,Cd1ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(3) plot(fCd2e,Cd2e3,'k',fCd2e,Cd2e4,'k',fCd2e,Cd2e5,'k',fCd2e,Cd2eq,'k', fCd2e,Cd2ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(4) plot(fCd3e,Cd3e3,'k',fCd3e,Cd3e4,'k',fCd3e,Cd3e5,'k',fCd3e,Cd3eq,'k', fCd3e,Cd3ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)') figure(5) plot(fCd4e,Cd4e3,'k',fCd4e,Cd4e4,'k',fCd4e,Cd4e5,'k',fCd4e,Cd4eq,'k', fCd4e,Cd4ef,'k') grid xlabel('Frequency (dB)') ylabel('Channel Capacity (Bit/Sec.)')

Категории