MATLAB: Finding the traffic intensity, A in Erlang B

erlangb

I am given the 1) blocking probability, B
2) Number of Trunk , N
Erlang B Equation
erlangb.PNG
B = (A^N/factorial(N))/sum(A^I/factorial(I),I,0,N)
How do i code to find the Traffic intensity, RHO in erlang B equation?
%%ACell = the RHO i want to find which is the A
%%N = trunk
%%FN = Factorial trunk
%%%B = blocking probability
syms I A
B = 0.05;
N = 55;
FNoC = factorial(N);
ACell = solve((A^N)/FN == B*symsum(A^I/factorial(I),I,0,N),A);

Best Answer

OK, that's some nasty equation you've got there. But the symbolic toolbox did find some solutions, in fact it found many (& complex)
syms I A
B = 0.05;
N = 55;
FN = factorial(N);
ACell = solve((A^N)/FN == B*symsum(A^I/factorial(I),I,0,N),A);
It returned 55 of them, 54 complex and 1 real.
>> length(ACell)
ans =
55
Let's convert to double, and take a look at the only real one:
>> A = double(ACell);
>> A = A(end)
A =
49.539390342298994
Seems to indicate that A is a little over 49.5. Does this make sense?
>> N = 55;
>> Erlang = @(A) (A^N/factorial(N))/sum(A.^([0:N])./factorial([0:N])) % Very ugly
>> Bx = Erlang(49.539390342298994) % should return original B = 0.05
Bx =
0.050000000000000
Of course the large factorials and ugly expression could be made far more robust, but it seems to work. For example probably should use cumprod instead of factorial, e.g:
>> factorial([1:7])
ans =
1 2 6 24 120 720 5040
>> cumprod([1:7])
ans =
1 2 6 24 120 720 5040
Related Question