0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ What is the error? $\endgroup$ – Bob Jansen Aug 14 '20 at 16:59
  • $\begingroup$ Matlab gives this error: Random variate function Z(t,X(t)) is invalid. $\endgroup$ – user48282 Aug 14 '20 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.