next up previous index
Next: Cumulative Distribution Function 10/5 Up: Densities 10/2 Previous: Densities 10/2

Examples with simulations 10/2

Here we will show intuitively what the density is as a limit of a histogram.

Example 1: Sum of two uniform random variables: X=U1+U2.

Matlab:

res.sum2=sum(rand(2,100000));
hist(res.sum2);
hist(res.sum2,100);

Here is what the output looked like for one of my simulations:

Notice the form of the histogram. It is very close to a triangle.

%And for 10 uniforms:
res.sum10=sum(rand(10,100000));
hist(res.sum10);
hist(res.sum10,100);

%Is for comments
Here is what the output looked like for one of my simulations:



Susan Holmes
1998-12-07