w=30000;m=3270;
l0=18000;beta=10^(-9);
d=w/m;
f=d/2:d:w-d/2;
k=max(size(f));
p=ones(1,k);
l=100:600:18100;
l1=linspace(.985,.872,m);
c=(.083*10^(-3)).*ones(1,k);hc=ones(1,k);

for t=1:k
r(t)=438.29996+33.3*(.01*f(t))+5.012*(.01*f(t))^2-.42*(.01*f(t))^3+.012*(.01*f(t))^4-.001*(.01*f(t))^5;

gamma(t)=sqrt((r(t)+i*2*pi*f(t)*l1(t))*(i*2*pi*f(t)*c(t)));
end
alfa1=unwrap(real(gamma));
for o=1:max(size(l))
alfa(o)=1.158*1.449*l(o)/l0;
;


for n=1:k
hc(n)=exp(-alfa(o)*f(n)^.5);
hx(n)=beta*f(n)^1.5;
end
cap(o)=0;
for n=1:k
cap(o)= cap(o)+d*1000*log2(1+hc(n)/(hx(n)));
end

for t=1:k

hc1(t)=exp(-alfa1(t)*2*l(o)*(.3048/1609.3));
%hc1(t)=exp(-1.4*.5*f(t)^.5);

end
cap1(o)=0;
for n=1:k
cap1(o)= cap1(o)+d*1000*log2(1+hc1(n)/(hx(n)));
end
for o=1:max(size(l))
capnat(o)=1000*(w*log(1/beta)-(2/3)*alfa(o)*w^1.5-1.5*w*(log(w)-1));
cap2(o)=(1/log(2))*capnat(o); 
end
end
caperor=cap-cap2;

semilogy(l,cap)
hold on
semilogy(l,cap1)
xlabel('lungimea perechii in ft')
ylabel('capacitatea in Mb/s')
title('Capacitatea perechii determinata de paradiafonie')
gtext('model f^.5')
gtext('model 26 AwG')