function z = erlkseq(k,N,s)
%ERLANGK Calculates a sequence of numbersfollowing the Erlang-k formula
%Call z = erlkseq(k,N,s)
%Where k = number of summed Possonian sequences
%      N = number points 
%      s = standard deviation of the original sequence
%          If omitted, defaults to 1. 
%          If a scalar, the generated sequence is scaled
%          If a vector 1xN, the constituent sequences are scaled
%      z = generated sequence
%
if nargin < 3,
   s =1'
endif;
if k == 1,
  z = s*(-log(rand(k,N)));
else
  z = s*sum(-log(rand(k,N)));
endif