erlang c coding, can someone fix this coding for me? i keep getting error and I don't know what's wrong. Thank you in advance

4 views (last 30 days)
clc;
clear all;
close all;
N_C= [1,2,3,4,5,10,20,40,80]; %Number of channel
T_tr = [0.1:0.1:100]; %Traffic intensity
%Erlang C equation
for i=1:length(N_C)
sum=0;
for k=0:N_C(i)
sum = T_tr.^N_C(i)/factorial(N_C(i))++(1--(T_tr/N_C))+sum+T_tr.^k/factorial(k);
end
Pr_delay (i,:) = T-tr.^N_C(i)/factorial(N_C(i))./sum;
%Loop for Part Using "N_C" Variable
end
figure
loglog(T_tr, Pr_delay(1,:),'-b', T_tr, Pr_delay(2,:),'-b', T_tr, Pr_delay(3,:),'-b', T_tr, Pr_delay(4,:),'-b',T_tr, Pr_delay(5,:),'-b', ...
T_tr, Pr_delay(6,:),'-b', T_tr, Pr_delay(7,:),'-b', T_tr, Pr_delay(8,:),'-b',T_tr, Pr_delay(9,:))
%Draw Log to Log Scale Graph, ...indicate continuvity
xlabel('{\itT}{tr} (erlangs)'), ylabel('Pr{block}');
%Label for both X and Y axis
axis([0.1 100 1e-4 1])
text(2.e-1,0.15,'{\itN}_c=1')
text(3.2e-1,3e-2,'2')
text(4.8e-1,1e-2,'3')
text(7.2e-1,5e-3,'4')
text(1.2,3e-3,'5')
text(3.4,1.5e-3,'10')
text(9.8,9e-4,'20')
text(20,7e-4,'40')
text(60,6e-4,'{\itN}_c=80')
%Parameters for the number of channels
title('Blocking probability of Erlang C');
grid

Answers (1)

Alan Stevens
Alan Stevens on 6 Nov 2020
Edited: Alan Stevens on 6 Nov 2020
Change
for k=0:N_C(i)
sum = T_tr.^N_C(i)/factorial(N_C(i))++(1--(T_tr/N_C))+sum+T_tr.^k/factorial(k);
end
Pr_delay (i,:) = T-tr.^N_C(i)/factorial(N_C(i))./sum;
to
for k=0:N_C(i)
sum = T_tr.^N_C(i)/factorial(N_C(i))+(1-(T_tr/N_C(i)))+sum+T_tr.^k/factorial(k);
end
Pr_delay (i,:) = T_tr.^N_C(i)/factorial(N_C(i))./sum;
and the result is

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!