美好的一天,我为这个问题编写了代码:
编写一个Matlab代码,分别输出2个,4个,5个,10个,20个和24个集群通道的阻塞概率和流量强度图表?
我只是想确保它的正确性。有人可以验证它的工作正常吗?谢谢。
clear all;
close all;
C=[2 4 5 10 20 24]; % The number of Servers
rho=[0.1:0.1:100]; % Traffic intensity rho = lambda/mu
for i=1:length(C),
inc=0;
for q=0:C(i)
inc=inc+rho.^q/factorial(q);
end
pb(i,:)=rho.^C(i)./factorial(C(i))./inc;
end
figure(1)
loglog(rho,pb(1,:),'-b',rho,pb(2,:),'-b',rho,pb(3,:),'-b',...
rho,pb(4,:),'-b',rho,pb(5,:),'-b',rho,pb(6,:),'-b',rho,pb(7,:),'-b',...
rho,pb(8,:),'-b');
%% ----------------------------Plotting---------------------------------
xlabel('Traffic Intensity,rho [Erlangs]');
ylabel('Probability of Blocking');
title('Probability of Blocking Vs Traffic Intensity');
axis([0.1 100 1e-4 1]);
text(2.e-1,0.15,'C=1');
text(3.2e-1,3e-2,'C=2');
text(4.8e-1,1e-2,'C=3');
text(7.2e-1,5e-3,'C=4');
text(1,3e-3,'C=5');
text(3.4,1.5e-3,'C=10');
text(9.8,1.6e-3,'C=20');
text(41,1.6e-3,'C=60');
grid on;
%% ------------------------------END---------------