I want to simulate a random walk in Matlab: I've found this code but it doesn't work. I have an error with the function S.simByEuler. Someone can explain me how to solve the error?
N = 60 F = @(t,X) zeros(N,1); %drift G = @(t,X) eye(N); %diffusion S = sde(F,G,'startState', discount_asset_price(1:60)'); M = 10 simulated_set = S.simByEuler(M,'nTrials',1,'Z',@(t,X) RandDir(N));
where discount_asset_price is the data.
Matlab gives this error: Random variate function Z(t,X(t)) is invalid.