Effacer les filtres
Effacer les filtres

Question about monte carlo simulation

1 vue (au cours des 30 derniers jours)
Bo Wang
Bo Wang le 4 Fév 2016
I have a question about Monte Carlo Simulation.
Suppose that three random numbers are generated. a) Determine the probability that the numbers are in increasing order using a Monte Carlo simulation where (i) the distribution is uniform in [
  4 commentaires
Bo Wang
Bo Wang le 4 Fév 2016
I know how to generate random numbers, I just don't know what the probability is. Is the probability should be 1/factorial(n) or probability should be 1?
Walter Roberson
Walter Roberson le 4 Fév 2016
Modifié(e) : Walter Roberson le 4 Fév 2016
You appear to be missing a few characters from the end of your question. Part of what is missing is whether the distribution is over integers or over real numbers.

Connectez-vous pour commenter.

Réponse acceptée

James Tursa
James Tursa le 4 Fév 2016
Modifié(e) : James Tursa le 4 Fév 2016
Monte Carlo means you will be estimating the probability by making a large number of sample runs (aka trials) and then counting. Suppose you have a loop that runs for 1000000 iterations. On each iteration you generate 3 random numbers and check to see if they are in increasing order. The estimated probability is then the number of times they were in increasing order divided by the total number of trials. E.g.,
n = 1000000; % <-- The total number of trials
count = 0; % <-- A counter to keep track of the number of successes
for k=1:n
% You put code here to generate your three random numbers
if( numbers are in increasing order ) % <-- You fill in this logic
count = count + 1;
end
end
estimated_probability = count / n;
  1 commentaire
Bo Wang
Bo Wang le 4 Fév 2016
this helps me a lot. Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Monte-Carlo dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by