Hey
i have a problem in computing a monte carlo simulation of an Ornstein -Uhlenbeck process. Does anybody know how to do it, in matlab or R if possible?
I found a matlab code at sitmo.com:
but that gives me just one rowvector, just one simulation. But I would need a lot more for my simulation. Does anybody can help me, Im really despearte, because I'm not good at writing codes and do need this simulation very badly
Hope anybody can help me!
regards
rina
i have a problem in computing a monte carlo simulation of an Ornstein -Uhlenbeck process. Does anybody know how to do it, in matlab or R if possible?
I found a matlab code at sitmo.com:
Code:
function S = OU_Simulate(S0, dT, n, mu, sigma, lambda)
a = exp(-lambda*dT);
b = mu*(1-a);
c = sigma*sqrt((1-a*a)/2/lambda);
S = [S0 filter(1,[1 -a], b+c*randn(1,n), a*S0)];
end
Hope anybody can help me!
regards
rina