MATLAB Answers

Locks
0

random walk in matlab without the econometrics toolbox

Asked by Locks
on 2 May 2013
Hi,
I am looking for a way to create a random walk in matlab without having the financial toolbox

  0 Comments

Sign in to comment.

1 Answer

Answer by Shashank Prasanna on 2 May 2013
 Accepted Answer

  6 Comments

Note that this is based on a FOR loop .. so you might want to implement your own algorithm based on a random vector and CUMSUM if it is too slow.
n = 200 ; m = 20 ;
figure ; hold on ;
for k = 1 : m
plot(cumsum((rand(1, n) > 0.5) - 0.5), 'Color', rand(1, 3)) ;
end
I will try that, thank you very much for the support

Sign in to comment.