June 23rd, 2006, 5:37 pm
Hi, I am trying to generate GBM in MATLAB with a Cholesky decomposition thrown in to ensure that the random numbers are really N(0,1) distributed. Try as I might, I can't get the standard deviation of the generated time series to come close to that of the input standard deviation. It is constantly is too small by a factor of around 3 -5. I have checked out the setting of the random number generator, and that isn't causing the problem. What I am missing here, any known issues? Thanks for your help, strategos % GBM(mean,sigma,n,T) simulates a geometric Brownian motion % on [0,T] using n normally distributed steps and parameters mean and% sigma; function [X] = GBM(mu,sigma,n,T) t = (0:1:n-1)'/n; t = t*T; % ensure N(0,1) distribution RNraw = randn(n-1,1); M = mean(RNraw); S = cov(RNraw); RNcorr = (RNraw-M)*inv(chol(S)); W = [0; cumsum(RNcorr)]/sqrt(n-1); W = W*sqrt(T); % analytical solution to GBM X = exp((mu-(sigma^2)/2).*t + sigma * W);