I am trying to generate a few samples of GBM using the following very simple MATLAB code:
function results=gbm(mean,vol,s0,T,shocks)
results = s0 * exp( (mean - vol^2/2) * T + vol^2 * sqrt(T) * shocks);
As you can see, I am using directly the closed form solution of the wiki page.
The thing is, I know that techincally E(St)=S0exp(μt), but when I do:
mean(gbm(0,.1,100,1,randn(1000,1)))
I get 99.54
as a result. How can that be?
I mean in the code above, I use μ=0, so I'm expecting E(St)=S0exp(0)=S0
I've been looking at this too much and there might be something obvious I'm missing here.
Answer
You have typo "vol^2", but it should be "vol".
Its √σ2T=σ√T
No comments:
Post a Comment