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.

scrstcat5.m
%fisrt block
R11=200e3;
R12=18e3;
R13=3e3;
R14=3e3;
R15=0.04e3;
R16=200e3;
C1=0.35e-12;
L1=3.8e-6;
a1=1;
b1=R11;
c1=0;
d1=1;
dn1=1;
a2=[C1 0];
b2=[R12*C1 1];
c2=[0 0];
d2=[C1 0];
dn2=[C1 0];
b1pb2=conv(b1,dn2)+conv(b2,dn1);
c1pc2=conv(c1,dn2)+conv(c2,dn1);
a1ma2=conv(a1,dn2)-conv(a2,dn1);
d1md2=conv(d1,dn2)-conv(d2,dn1);
b1b2=conv(b1,b2);
b1d2pd1b2=conv(b1,d2)+conv(d1,b2);
a1b2pb1a2=conv(a1,b2)+conv(b1,a2);
dn12=conv(dn1,dn2);
adn=conv(b1pb2,dn12);
ca=conv(b1pb2,c1pc2)-conv(a1ma2,d1md2);
aa=conv(a1b2pb1a2,dn12);
ba=conv(b1b2,dn12);
da=conv(b1d2pd1b2,dn12);
if adn(3)==0 | ca(3)==0 | ba(3)==0 | aa(3)==0 | da(3)==0
    aa=aa(1:2);
    ba=ba(1:2);
    ca=ca(1:2);
    da=da(1:2);
    adn=adn(1:2);
end
a3=1;
b3=R13;
c3=0;
d3=1;
dn3=1;
a4=[(R15+R16)*L1 R15*R16];
b4=[0 0];
c4=[L1 R16];
d4=[(R15+R16)*L1 R15*R16];
dn4=[(R15+R16)*L1 R15*R16];
a5=1;
b5=R14;
c5=0;
d5=1;
dn5=1;
a34=conv(a3,a4)+conv(b3,c4);
b34=conv(a3,b4)+conv(b3,d4);
c34=conv(c3,a4)+conv(d3,c4);
d34=conv(c3,b4)+conv(d3,d4);
dn34=conv(dn3,dn4);
ab=conv(a34,a5)+conv(b34,c5);
bb=conv(a34,b5)+conv(b34,d5);
cb=conv(c34,a5)+conv(d34,c5);
db=conv(c34,b5)+conv(d34,d5);
bdn=conv(dn34,dn5);
bapbb=conv(ba,bdn)+conv(bb,adn);
capcb=conv(ca,bdn)+conv(cb,adn);
aamab=conv(aa,bdn)-conv(ab,adn);
damdb=conv(da,bdn)-conv(db,adn);
babb=conv(ba,bb);
badbdabb=conv(ba,db)+conv(da,bb);
aabbpbaab=conv(aa,bb)+conv(ba,ab);
abdn=conv(adn,bdn);
dn=conv(bapbb,abdn);
c=conv(bapbb,capcb)-conv(aamab,damdb);
a=conv(aabbpbaab,abdn);
b=conv(babb,abdn);
d=conv(badbdabb,abdn);
f=[1:200]/200*40e6;
hsn=20000*dn;
hsd=10000*10000*c+10000*d+10000*a+b;
nnorm=hsn(1);
hsnn=hsn/nnorm;
rtn=roots(hsnn);
dnorm=hsd(1);
hsdn=hsd/dnorm;
rtd=roots(hsdn);
n=0;
for i=1:size(rtn)
    for j=1:size(rtd)
        if abs(rtn(i)-rtd(j))<1e-6
            n=n+1;
            compoly(n,:)=[1 -rtn(i)];
        end
    end
end      
for i=1:n
    hsnn=deconv(hsnn,compoly(i,:));
    hsdn=deconv(hsdn,compoly(i,:));
end
h=freqs(hsn,hsd,2*pi*f);
hsnn=nnorm*hsnn;
hsdn=dnorm*hsdn;
ndnorm=hsnn(length(hsnn));
hsnn=hsnn/ndnorm;
hsdn=hsdn/ndnorm;
h1=freqs(hsnn,hsdn,2*pi*f);
cstkmdl=-26+15*log10(f/1e7);
figure(1)
plot(f,cstkmdl,f,20*log10(abs(h1)))
grid
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')

Contact us