Loop to generate n random series (filling a matrix?)

Hi, i´m glad if you could help me with this
I have a funcion that generate a random trajectory for a variable (like a brownian motion, with a trend + a random shock normally distributed).
x=simBM(n,delta,mu,sigma)
This function generate a vector of n/delta rows, that represent the trajectory of the variable.
What i want is to generate 1000 of this trajectories making a loop (i think i should store them as 1000 columns of a matrix)
I have used loops before, but in this case i don´t know how to do it, because what i need to do is like a loop over the random shock of the function
I don´t know if this is an easy question, buy i am a begginer with matlab. Thank you very much! Javier

답변 (1개)

Iman Ansari
Iman Ansari 2013년 4월 17일

0 개 추천

Maybe this:
for i=1:1000
x(:,i)=simBM(n,delta,mu,sigma);
end

댓글 수: 1

Javier
Javier 2013년 5월 9일
I don´t know why, but that did not work.
I have solved the problem this way:
while c<=number
theta(:,c)=simGBM(n,theta0,alpha,sigma,delta); c=c+1; end
THANK YOU ANYWAY!!!!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2013년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by