Exercises 2: 1 Box-Muller Transform

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Exercises 2

26.04.2013

Box-Muller Transform

Implement the Box-Muller transform as a function and plot a histogram of the


resulting random numbers. Compare the result with the probability density
function of a Gaussian distribution.

Inverse Transform

The exponential distribution has a probability density function fX (x, ) (a plot


for = 1 is shown in Fig. 1) defined by:
(
ex , x 0,
fX (x; ) =
(1)
0,
x < 0.
Calculate the inverse transform.
Generate 10000 exponentially distributed random numbers ( = 1) from
uniformly distributed random numbers, plot a histogram and compare it
to Fig. 1.
Plot a normalized histogram using the trapz and bar commands.

The Central Limit Theorem

The random variables X1 , X2 , Xn are each defined as the sum of a uniformly


(interval [0, 1]) and an exponentially ( = 1) distributed random variable.
PN
Plot the histograms consisting each of 100000 samples of
n=1 Xn for
N = 1, 5, 10. Choose an appropriate number of bins for the histograms.
What to the shapes remind you of? Why (Do a google search for the
central limit theorem)?

Figure 1: The probability density function of the exponential distribution for


=1

You might also like