University of Massachusetts Lowell

Electrical and Computer Engineering

25.108 Introduction to Engineering II

“Fun” With Probability

Have you ever been to the Science Museum and seen an experiment with a bunch of balls which when the fall tend to look like a bell curve? This is an example of an effect which occurs throughput nature called the Central Limit Theorem which says that any outcome formed by summing a large number of random occurrences will have the bell curve, just like you see at the science museum.

Part A.

Step 1. Create an array of 100,000 samples of a uniform random variable on the interval (0,1).Use the “rand” function.

Step 2. Create a histogram of the samples with 100 bins. Notice for the most part that there are approximately 1000 points in each bin which is what you would expect.

a.  Using your array, find out how many points are >0.5, and divide by the total which is 100000. What would you expect before doing it and what result did you get

b.  Try the same thing for number of points >0.25. And compare with what you would expect

c.  Take your array and subtract 0.5 from each number and do the histogram again, note that the numbers are centered on 0 rather than 0.5.

Part B.

Create an array 30,100000 of uniform random numbers on the interval 0,1. Use the command (rand(30,100000). Make the numbers go between -0.5 and .5 by subtracting 0.5 from each value.

Flip coins by using the command rightleft=MyArray>0

See how many are heads and tails by doing sum(rightleft).

Create an X-axis from x=0:1:30

Plot a histogram of the number of heads which occurred hist(yoursum,x)

Note it looks just like what you see at the science museum

Part C.

Take 100000 samples of a Gaussian random variable (randn(100000,1);

Find how many points lie between -1 and 1 (hint the answer should be about 2/3) which is the probability of being within 1 standard deviation of the mean.