Hi,
I started using Matlab to run Monte Carlo Simulation just a few weeks ago. I have a question about the iteration count:
My code looks like this:
% Toll Road Brownian Motion Problem
% Set the initial parameters
mu=0.2;sigma=0.1;price=3;n=35;% Generate the initial traffic amount
R(1,1)=normrnd(10000,3000);% Brownian Motion Iteration (Traffic)
for i=2:36 R=R.*exp((mu-sigma-0.5*sigma^2)*1+sigma*normrnd(0,1)*1);end;% Revenue Calculation (Revenue)
Revenue=price*R*365;
This code runs good except that since I generated random numbers, I would like to generate them for 1000 times, and get the average value out of all the 1000 simulations.
I wanted to add
for k=1:1000
But I don't know how my R matrix can interact with this extra k count.
I'd really appreciate it someone could offer a bit of advice.
Thanks a lot.
Ying
Best Answer