Starting from:

$24.99

PEAP Lab 5-Random number generation Solution


Consider the following distributions:

• A continuous uniform distribution between [10, 20]
• A discrete distribution, that returns the following values with the given probability

Value Probability
5 0.2
15 0.6
20 0.2

• An exponential distribution with average 15
• An hyper-exponential distribution with two stages, characterized by (l1 = 0.1, l2 = 0.05, p1 = 0.5)
• An hypo-exponential distribution with two stages characterized by (l1 = 0.1, l2 = 0.2)
• An Hyper-Erlang characterized by the following branches, number of stages, rates and selection probabilities

Num. stages (k) Rate (l) Probability
1 0.02 0.1
2 0.2 0.4
3 0.25 0.5


For each distribution, generate N = 500 samples using the techniques seen during the course (you can use the function that returns a uniformly distributed random number of your tool), and plot their approximated CDF on the same graph. Also compute, for each of them, the average and the C.V. starting from the generated samples.



OPTIONAL*

Compare for the considered continuous distribution except the Hyper-Erlang, compare the average and the C.V. with the one from their analytical expression.
Tools like MatLab, already have methods for generating samples from distributions: look for them, and if available, compare the results obtained with such algorithms with the one above.
Also try to replace the internal uniform number generator, with the linear congruential generator algorithm seen during the lesson.





* Optional parts are useful to challenge your understanding of the topic. You are encouraged to do them, but they will not asked during the exam

More products