Home > matpower7.0 > extras > syngrid > lib > sg_poissrnd.m

sg_poissrnd

PURPOSE ^

SG_POISSRND Replacement for POISSRND from the Statistics Toolbox

SYNOPSIS ^

function Nb = sg_poissrnd(Lambda,m,n)

DESCRIPTION ^

SG_POISSRND  Replacement for POISSRND from the Statistics Toolbox

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005