Monte Carlo Simulation using normal random sampling (Gaussian distribution)

15 vues (au cours des 30 derniers jours)
anna diederichs
anna diederichs le 24 Juil 2018
Commenté : Jeff Miller le 25 Juil 2018
Hello. I am trying to run a Monte Carlo simulation on my data. I have a loop running to calculate the data points, each with an associated error. For the Monte Carlo simulation, I want to plot a histogram that shows normal distribution (not random) with a mean of 60 and show 1 standard deviation. I want the Monte Carlo simulation to run 1000 times (r). I am having trouble integrating normrnd into my Monte Carlo loop. Below is my code using rand instead of normrnd. How do I do this with a Gaussian distribution, not just random? Thank you very much in advance.
%code:
xmax=x+xerror;
ymin=y-yerror;
ymax=y+yerror;
zmin=z-zerror;
zmax=z+zerror;
r=1000;
disp_x=xmin+(xmax-xmin).*(rand(r,1));
disp_y=ymin+(ymax-ymin).*(rand(r,1));
disp_z=zmin+(zmax-zmin).*(rand(r,1));
**calculation of 'dip' from my imported data using disp_x, disp_y and disp_z **
hist(dip,50)
  1 commentaire
Jeff Miller
Jeff Miller le 25 Juil 2018
It is not really clear what you are trying to do or why you are having trouble integrating normrnd. For starters, please say why this does not give what you want:
disp_x = normrnd(60,1,r,1);

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by