matlab代写-ENSimulation and Design of Experiments

ENSimulation and Design of Experiments

Homework 5: Generating random variates

Due: Thursd×v. March 7

In this homework, you will continue to practice generating random variables from various discrete and continuous distributions.


The Weibull distribution has domain [0, ‹x›). It has two parameters: a scale parameter 2 > 0 and a shape parameter k > 0. Its CDF on that domain is:

F (x) = 1—— •’²

As you can see, it is a generalization of the exponential distribution. Here is the Wikipedia image of its density function, for some choices of the shape parameter:

A – 1. R = 0.5

A= 1. k= 1



10 1.5

By Caliino – Own work, after Philip Leitch., CC BY-SA 3.0, https:’/’w’index.php?curid=96718l4

Use the inverse transform method to generate large samples from this distribution, for these same values of the parameters. Use properly normalized histogram plots to show that your sampled results conform closely to the true density functions shown above. Show your work in deriving the inverse transform function.

2. Could we have sampled from the Weibull using acceptance/rejection? Study the case 2 — 1and k – 2 in particular. Use the exponential (1) distribution as the known distribution. Find the ratio of the 2 density functions, then find where that ratio has a maximum, then find what that maximum is. Use that information to build an acceptance/rejection generator for the Weibull distribution. Using that generator, produce a sample of size 1e5 and show a histogram of the results (Matlab can take up to about 10 minutes to do this). You can use Matlab’s symbolic toolbox for the calculus. See me if you do not know how to do this.