Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

please help

3 visualizaciones (últimos 30 días)
Manu Young
Manu Young el 25 de Jun. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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. 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 comentarios
Manu Young
Manu Young el 25 de Jun. de 2011
I have tried 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. 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]
came up with
n= 10000
p=zeros(100,1);
for k=1:100, % 100 trials
X=ceil(6*rand(1,n));
Y=ceil(6*rand(1,n));
w = X + Y;
p(k)=sum(w ==7)/n;
end
plot(1:100,p)
xlabel('number of trials')
ylabel('Average frequency ratio')
Not very about my answer
Thanks
Rick Rosson
Rick Rosson el 25 de Jun. de 2011
It looks like you are making good progress. What is your question?

Respuestas (1)

Walter Roberson
Walter Roberson el 25 de Jun. de 2011
Refer to the assistance already given to southie on the identical question: http://www.mathworks.com/matlabcentral/answers/10228-help-me-please

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by