% Vasicek process
% dX = a(c - X) dt + b dW 
% plot individual copies of the process
% play with the values of a,b,c to see what they mean

a = 1 ;
b = 4 ; 
c = 8 ; 

T = 5 ;
N = 500 ;
h = T/N ;
t = (0:N)*h ; 

X0 = 0 ; 
X = X0*ones(1,N+1);
Z = randn(1,N); 

for i=1:N
    X(i+1) = X(i) + a*(c-X(i))*h + b * sqrt(h)*Z(i) ;
end

plot(t,X)