Simuler de 1 000 mouvements browniens géométriques dans MATLAB

J'ai actuellement de code pour simuler un géométriques Marron mouvement, avec l'aimable autorisation de http://www-math.bgsu.edu/~zirbel/sde/matlab/index.html.

Cependant, je tiens à générer de 1 000 simulations et à les afficher dans un graphique.

Les codes que j'ai en ce moment pour produire une seule simulation sont comme suit:

% geometric_brownian(N,r,alpha,T) simulates a geometric Brownian motion 
% on [0,T] using N normally distributed steps and parameters r and alpha

function [X] = geometric_brownian(N,r,alpha,T)

t = (0:1:N)'/N;                   % t is the column vector [0 1/N 2/N ... 1]

W = [0; cumsum(randn(N,1))]/sqrt(N); % S is running sum of N(0,1/N) variables

t = t*T;
W = W*sqrt(T);

Y = (r-(alpha^2)/2)*t + alpha * W;

X = exp(Y);

plot(t,X);          % plot the path
hold on
plot(t,exp(r*t),':');
axis([0 T 0 max(1,exp((r-(alpha^2)/2)*T+2*alpha))])
title([int2str(N) '-step geometric Brownian motion and its mean'])
xlabel(['r = ' num2str(r) ' and alpha = ' num2str(alpha)])
hold off
InformationsquelleAutor alexalexalex | 2013-09-08