0% found this document useful (0 votes)
48 views3 pages

Erlag B, C

This MATLAB code calculates Erlang B and Erlang C blocking probabilities for different values of traffic intensity (A) and number of channels (N). It plots Erlang B in blue and Erlang C in red on the same graph for comparison. The red Erlang C line lags behind the blue Erlang B line as expected, since Erlang C represents the probability of a call being delayed while Erlang B is the probability of immediate call blocking.

Uploaded by

sak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views3 pages

Erlag B, C

This MATLAB code calculates Erlang B and Erlang C blocking probabilities for different values of traffic intensity (A) and number of channels (N). It plots Erlang B in blue and Erlang C in red on the same graph for comparison. The red Erlang C line lags behind the blue Erlang B line as expected, since Erlang C represents the probability of a call being delayed while Erlang B is the probability of immediate call blocking.

Uploaded by

sak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

MATLAB CODE

close all
clear all
lambda=0:0.0001:0.0065; % mean arrival rate (calls per second)
d=200; % mean duration (seconds per call)
A = lambda.*d; % traffic intensity in Erlangs
N = 1;
[ B, Bd ] =erlangb( N, A )
% Bd=erlangb(N, A)
% B = erlangb(N, A); % n channels/servers
ii=find(B<0.1);
jj=find(Bd<0.1)
plot(A(ii), B(ii), 'b')
hold on
plot(A(jj), Bd(jj), 'R')
hold on
N = 2;
[ B, Bd ] =erlangb( N, A )
ii=find(B<0.1);
jj=find(Bd<0.1)
plot(A(ii), B(ii), 'b')
hold on
plot(A(jj), Bd(jj), 'R')
hold on
N = 3;
[ B, Bd ] =erlangb( N, A )
plot(A, B, 'b')
hold on
plot(A, Bd, 'R')
hold on
N = 4;
[ B, Bd ] =erlangb( N, A )
plot(A, B, 'b')
hold on;
plot(A, Bd, 'R')
hold on
xlabel('Traffic Intensity (Erlangs)');
ylabel('Blocking Probability');
title('Erlang B/C formula,suleiman saleh said 2820170009');
plot(A, 0.02, ':k') % 2% line
grid on;
end

function [ B, Bd ] =erlangb( N, A )
% Define the erlang function
% function B = erlangb(N, A)
if (length(N)~=1) | (fix(N) ~= N) | (N < 0)
error('N must be a scalar positive integer');
end
% TODO: test that elements of A are real and positive here?
esum = zeros(size(A))
for ii=0:N
esum = esum + A .^ ii ./ factorial(ii);
end
B = A .^ N ./ (factorial(N) .* esum)
for jj=0:N-1
esum1 = esum + A .^ ii ./ factorial(ii);
end
Bd= A .^ N./((A .^ N)+factorial(N).*(1-A./N).*esum1)
end

OBSERVATION:

Red line: Erlang C

Blue Line: Erlang B


The red line represent Erlang C while the blue line represent the Erlang B, as we expected that the Erlang C which
represent the probability of the delay call ( call being hold for a while before dropped ) to be lagging behind the Erlang
B which represent the probability of a call to be blocked immediately if no free channel is available

Erlang C lagg behind Erlang B

You might also like