%Simulation d'un mouvement brownien multidimensionnel %dont les composantes sont corrélées %à l,aide de la décomposition de Choleski clear all; clc; n_traj = 20000; %Number of paths n_per =10; %Number of time periods Delta_t = 0.1; %length of a time step T=n_per*Delta_t; %Maturity date d = 3; %dimension of the Brownian motion %correlation matrix Gamma = [1 0.2 0.8; 0.2 1 0.5; 0.8 0.5 1] choleski_G = chol(Gamma) %Choleski decomposition %Initialisation of the matrices W = zeros(n_per+1,d); test = zeros(n_per+1,d); %Simulation de chaque trajectoire du mouvement brownien multidimensionnel for j=1:n_traj Z = normrnd(0,1,n_per,d); %mxd matrix of N(O,1) r.v. for i = 1 : n_per %Multidimensionnal Brownian motion W(i+1,:) = W(i,:) + sqrt(Delta_t)*Z(i,:)*choleski_G; end test(j,:) = W(n_per+1,:); end %calcul des matrices de covariance covarianceW = cov(test) correlationW = covarianceW / T