function B=erlangb_iterative(p,c)

if ((floor(c) ~= c) || (c < 1))

warning('n is not a positive integer');

B=NaN;

return;

end;

if (p < 0.0)

warning('p is negative!');

B=NaN;

return;

end;

B=1;

for k=1:c,

B=((p*B)/k)/(1+p*B/k);

end;

endfunction

Here is the formula I wrote in matlab/octave to calculate the Erlang-B

formula (the erlang B formula is referred to another post uploaded here. It

accepts 2 inputs p and c and produces a result B. with this kind of inputs

>> B=erlangb_iterative(77,1)

B = 0.98718

>> B=erlangb_iterative(77,10)

B = 0.87201

>> B=erlangb_iterative(77,80)

B = 0.063644

>> B=erlangb_iterative(77,100)

B = 0.0017401

>> B=erlangb_iterative(77,150)

B = 5.9709e-14

>> B=erlangb_iterative(77,200)

B = 9.1323e-32

I see that I get various results, which are not the same regarding the y

axis (B).

When I try to plot the formula for a constant p=77 let's say,

C=1:5:200;

figure(1);

plot(C,erlangb_iterative(77,C) );

title ("Pblocking regarding telephone lines");

I get a wrong plot which "says" that the result B is constant and equals

almost 1, which is wrong.

Can you please provide advice on how to plot the formula?

Thanks!

--

Sent from:

http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html