WDM Network Blocking Computation Toolbox

Przemyslaw Pawelczak (view profile)

21 Apr 2004 (Updated )

Blocking computation in WDM Networks for three different types of constraints.

varargout=erlang_b(varargin)
```function varargout=erlang_b(varargin)
%ERLANG_B Erlang-B formula.
%   [B]=ERLANG_B(L,C,K) is a script that computes probability of finding K
%   channels in M/M/C loss system. Solution is stored in B, L is the
%   offered load (in Erlangs) and C is the number of channels.

%   E-mail: przemyslaw_pawelczak@idg.com.pl
%   Wroclaw University of Technology, Poland
%   \$Revision: 1.0 \$  \$Date: 2004/05/18 20:43:12 \$

%Exeption handling
message=nargchk(3,3,nargin);
testing_int=[varargin{1},varargin{2},varargin{3}];
if ~isempty(message)
error('MATLAB:ERLANG_B:NumberOfInputArguments',...
message);
end
if find(isnan(testing_int))
error('MATLAB:ERLANG_B:ArgumentType',...
'Arguments must be numbers.');
end
%Check if VARARGIN are positive integers
if sum([varargin{2}<0,fix(varargin{2})~=varargin{2}])~=0
error('MATLAB:ERLANG_B:ArgumentType',...
'Arguments must be positive integers.');
end

%Change string into number (for all number arguments)
for k=1:3
if isstr(varargin{k})==1
varargin{k}=str2num(varargin{k});
end
end

%Give names to input arguments
L=varargin{1};
C=varargin{2};
K=varargin{3};

%Initialize variable
sum_down=[];
for k=0:C
sum_down=[sum_down,L^k/factorial(k)];
end
%Assign solution
varargout{1}=(L^K/factorial(K))/sum(sum_down);```