nileshjoshi
Newbie level 4
erlang b table
Here is the matlab code for Erlang table varification. This is the first step for simulation of Channel allocation for GSM system. If anyone need the channel allocation matlab program I am ready to provide him all the matlab code for that.
********Here is the matlab code***************************
Here is the matlab code for Erlang table varification. This is the first step for simulation of Channel allocation for GSM system. If anyone need the channel allocation matlab program I am ready to provide him all the matlab code for that.
********Here is the matlab code***************************
Code:
format short
clear all;
block=0;
S=0;
avholding=input('enter the average holding time= ');
inarrival=input('enter the call arrival rate = ');
channel=input('enter the total no of available channel= ');
nuser=input('enter the total no of calls= ');
a=-avholding*log(rand(nuser,1));
b=-(60/inarrival*log(rand(nuser,1)));
d(1,1)=b(1,1);
ma=mean(a);
mb=mean(b);
offeredtraffic=ma/mb
for i=2:nuser
d(i,1)=b(i,1)+d(i-1,1);
end
s=d+a;
g=cat(2,d,s)
for i=1:channel
for j=1:2
k(i,j)=g(i,j);
end
end
k;
for i=1:channel
for j=1:2
g(i,j)=NaN;
end
end
g(any(isnan(g),2),:) = [];
[xi,yi]=size(k);
[x,y]=size(g);
minimum=min(k(:,2));
for i=1:x
%for j=1:y
minimum=min(k(:,2));
for I=1:xi
% for J=1:yi
if k(I,2)==minimum
ri=I;
end
%end
end
ca=k(ri,:);
k(ri,:)=[];
if g(i,1)<=minimum
g(i,:)=NaN;
t=cat(1,k,ca);
k=t;
block=block+1;
else
t=cat(1,k,g(i,:));
g(i,:)=NaN;
k=t;
S=S+1;
end
%end
end
block;
served=S+channel;
Gos=block*100/nuser;
Gos1=theoritical(channel,offeredtraffic);
fprintf('Gos of system from sumulation is %g\n',Gos);
fprintf('Gos of system from Erlang formula is %g\n',Gos1);