how to run monte carlo simulation in excel for each iteration separately using normrnd command?
4 views (last 30 days)
Show older comments
how to generate monte carlo simulation in excel separately for each samples of i in this code? anyone pls help me
% clc;
mRob=500;
mRbc=750;
muRob=5;
muRbc=7.5;
SRob=5/4;
SRbc=7.5/3;
Dy=14.5;
x=1;
rop=0;
alpha=50*pi/180;
count=0;
for i=1:10000
mRobr=mRob+normrnd(muRob,SRob);
mRbcr=mRbc+normrnd(muRbc,SRbc);
mx(i)=normrnd(muRob,SRob);
my(i)=normrnd(muRbc,SRbc);
Yact=mRob*cos(alpha)+sqrt(mRbc^2-mRob^2*(sin(alpha)^2));
Ycal=mRobr*cos(alpha)+sqrt(mRbcr^2-mRobr^2*(sin(alpha)^2));
Dya=abs(Yact-Ycal);
if Dya<=Dy
count=count+1;
end
if Dya>rop
rop=Dya;
end
end
XX=max(mx);
YY=min(mx);
ZZ=max(my);
AA=min(my);
rel=count/i;
unrel=1-rel;
4 Comments
Walter Roberson
on 20 Sep 2016
Edited: Walter Roberson
on 20 Sep 2016
You just edited the question to provide your code, but you did not answer my questions about how Excel is intended to be used.
With the addition of your code, your question is looking like a duplicate of one of your previous questions.
Answers (1)
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!