How to implement a Correlated Brownian Motion correctly

12 visualizaciones (últimos 30 días)
Nina
Nina el 12 de Dic. de 2017
Editada: Walter Roberson el 29 de Abr. de 2018
I have trouble implementing a Correlated Brownian Motion. I need the simulation for 1000 paths and T=5. Only the values of the evolution for t=1 and T=5 are relevant. The following code is running, but does not return the expected values. Does anybody know what I did wrong? Thankful for any advice or hint!
X1=100;
X2=90;
r=0.03;
sigma1=0.25;
sigma2=0.25;
rho=0.5;
T=5;
sigma=[sigma1 0;0 sigma2];
corr=[1 rho;rho 1];
cov=sigma*corr*sigma;
R=chol(cov,'lower');
N=1000;
X1_t=zeros(N,T+1);
X1_t(:,1)=A_0;
X2_t=zeros(N,T+1);
X2_t(:,1)=L_0;
dt=1;
for i=1:N
X=randn(T,2);
W=X*R;
for j=2:T+1
X1_t(i,j)=X1_t(i,j-1)*exp(r*dt+sigma1.*W(j-1,1)-(sigma1.^2./2)*dt);
X2_t(i,j)=X2_t(i,j-1)*exp(r*dt+sigma2.*W(j-1,2)-(sigma2.^2./2)*dt);
end
end
  2 comentarios
Walter Roberson
Walter Roberson el 20 de Abr. de 2018
Please do not close Questions that have an Answer.
Walter Roberson
Walter Roberson el 29 de Abr. de 2018
Editada: Walter Roberson el 29 de Abr. de 2018
Do not close questions that have an answer. The answer may be of use to other people.

Iniciar sesión para comentar.

Respuestas (1)

jean claude
jean claude el 12 de Dic. de 2017
  1 comentario
Nina
Nina el 12 de Dic. de 2017
Thank you very much for the link, but I would like to solve it with the for-loops :-/

Iniciar sesión para comentar.

Categorías

Más información sobre Networks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by