SG_POISSRND Replacement for POISSRND from the Statistics Toolbox
0001 function Nb = sg_poissrnd(Lambda,m,n) 0002 %SG_POISSRND Replacement for POISSRND from the Statistics Toolbox 0003 0004 % SynGrid 0005 % Copyright (c) 2018, Electric Power and Energy Systems (EPES) Research Lab 0006 % by Hamidreza Sadeghian, Virginia Commonwealth University 0007 % 0008 % This file is part of SynGrid. 0009 % Covered by the 3-clause BSD License (see LICENSE file for details). 0010 0011 Nb = zeros(1,n); 0012 for i = 1:n 0013 count = 0; 0014 evnt = rand(1); 0015 while evnt >= exp(-Lambda) 0016 evnt = evnt*rand(1); 0017 count = count+1; 0018 end 0019 Nb(1,i) = count; 0020 end