function ErlangB
clc;
pn=[];
s=[];
x=1:100; %横坐标范围
m=[4 5 8 10 15 20 25 30 40 50 60 75 90 100]; %交换机出线容量
L=length(m);
for i=1:L
for a=1:100 %流入话务量强度
for k=1:m(i)
s=[s,a.^k/factorial(k)];
add=sum(s);
end
pn0=(a.^m(i)/factorial(m(i)))./add;
pn=[pn,pn0]; %顾客被拒绝的概率
s=[];
end
loglog(x,pn); %对数坐标
set(gca,'XGrid','on'); %画网格线
set(gca,'XMinorTick','off');
set(gca,'XTick',[1 2 4 6 8 10 20 40 60 80 100]); %x坐标轴刻度设置
set(gca,'XMinorGrid','off');
set(gca,'Ylim',[0.001 1]); %限定纵坐标的取值范围
set(gca,'YGrid','on');
set(gca,'YMinorTick','off');
hold on
pn=[];
end
xlabel('话务量强度α(erl)','fontsize',8);
ylabel('呼损率Pc','fontsize',8);
for j=1:3 %输入y轴坐标值
gtext('2');
gtext('4');
gtext('6');
gtext('8');
end
gtext('m=4'); %用鼠标在图形上输入注释
for i=2:L
gtext(int2str(m(i)));
end