Monte Carlo Simulation using normal random sampling (Gaussian distribution)
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Jeff Miller
2018 年 7 月 25 日
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);
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!