Simulation of tossing a pair of fair dice can be done using the following two
MATLAB lines
X=ceil(6*rand(1,n));
Y=ceil(6*rand(1,n));
where n is the number of tosses.
1. Write a MATLAB script to determine the probability P[X+Y=7]. Use a "for" loop to run simulation fifty times with n = 10000. Plot the 100 estimated probability values along with the theoretical result of P[X+Y=7].
2. Write a MATLAB script to do the following
a. Create 10000 random variables uniformly distributed between 2 and 4.
b. Create a histogram to approximate the actual probability density function.
c. Superimpose the actual probability density function to the above histogram.
3. Write a MATLAB script to do the following
a. Create 10000 Gaussian random variables with m =2 and s = 3.
b. Create a histogram to approximate the actual probability density function.