Monte Carlo Simulation using normal random sampling (Gaussian distribution)
Mostra commenti meno recenti
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 Commento
Jeff Miller
il 25 Lug 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);
Risposte (0)
Categorie
Scopri di più su Monte-Carlo in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!