Section: Random Number Generation
y = randbin(N,p)
where N
is a vector representing the number of Bernoulli
trials, and p
is the success probability associated with each
trial.
N
Bernoulli trials, with the probability of
success in each trial being p
. The probability distribution
is
10
binomial random variables, corresponding
to N=100
trials, each with probability p=0.1
, using
both randbin
and then again using rand
(to simulate the trials):
--> randbin(100,.1*ones(1,10)) ans = 13 6 8 9 11 9 6 9 7 10 --> sum(rand(100,10)<0.1) ans = 8 12 10 7 12 4 11 8 9 6