how to run monte carlo simulation in excel for each iteration separately using normrnd command?

4 views (last 30 days)
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
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.
Pavithra V
Pavithra V on 20 Sep 2016
i am asking how to create a random value with normrnd and pass that value to an Excel macro to run some command there?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 20 Sep 2016
Edited: Walter Roberson on 20 Sep 2016

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!