You are on page 1of 2

Redes 2

José Patricio Puebla Álvarez (18208)

21/09/10

Corrección Simulación

En cursiva y subrayado se resaltan las correcciones.


for j=1 : length(l);
for i=1 : total_frames
% Sensing the channel
idle_channel = M*(random('poiss',(a*l(j)*P)));
% If the Channel is not Idle, Delay
while idle_channel > 1.0
delay = P*round(random('unif',0,K-1));
total_time(j)=total_time(j) + delay;
idle_channel = M*(random('poiss',(a*l(j)*P)));
end

% If the Channel is Idle, Tranmission


total_time(j) = total_time(j) + tau + P;
more_arrivals = M*(1-random('poiss', (a*l(j)*P)));
while more_arrivals > 1.0 % test for collisions
% If collision while transmitting
total_time(j) = total_time(j) + 2*tau ;
more_arrivals = M*(1-random('poiss', (a*l(j)*P)));
end
end

% Calculing the network utilization


S(j)=total_frames*(tau+P)./total_time(j)
end

semilogx(G,S)
set(gca,'Title',text(0,0,'G vs S'));
set(gca,'XLabel',text(0,0,'G'));
set(gca,'YLabel',text(0,0,'S'));
hold on

% Analytical Calculus
g=[1:1000]/100;
s1=(g.*exp(-a.*g))./((1+2*a).*g + exp(-a.*g));
semilogx(g,s1,'ro');
hold off

Algunos gráficos obtenidos son:

Longitud de trama = 64
Tau = 0.0001

0.35

0.3

0.25

0.2

0.15

0.1

0.05

0
1 2 3 4 5 6 7 8 9 10

Longitud de trama = 64

Tau = 0.00001

G vs S
0.35

0.3

0.25

0.2
S

0.15

0.1

0.05

0
-2 -1 0 1
10 10 10 10
G

Longitud de trama = 128

Tau = 0.0001
G vs S
0.35

0.3

0.25

0.2
S

0.15

0.1

0.05

0
-2 -1 0 1
10 10 10 10
G

You might also like