supa
By: a guest | Jan 28th, 2010 | Syntax:
None | Size: 0.63 KB | Hits: 101 | Expires: Never
trials = 100000;
X_vector = random( ' Binomial ' , 10 , 0.6 , 1 , trials )
end
bar ( count
( : , 1
) , count
( : , 2
) / trials
) ;
Simulate and
plot the probability mass functions
for the following random variables:
1.
Binomial with parameters n = 20 and p = 0.2
(you will need
more bins in your histogram
)
2. Geometric random variable with parameter p = 0.1 (choose reasonable number of bins). Note that they
define the geometric as the number of failures after a success
which is why you can
get zero.
3. Poisson random variable with parameter lamda= 3