random walk in matlab without the econometrics toolbox

Hi,
I am looking for a way to create a random walk in matlab without having the financial toolbox

 Respuesta aceptada

Shashank Prasanna
Shashank Prasanna el 2 de Mayo de 2013

6 comentarios

Locks
Locks el 2 de Mayo de 2013
thanks, but I am not sure if that's what I am looking for. it seems to me that those plots are modelling something such as returns, but I am looking more for a random walk that models stock paths
Locks
Locks el 2 de Mayo de 2013
thanks!
Cedric
Cedric el 2 de Mayo de 2013
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
Locks
Locks el 2 de Mayo de 2013
I will try that, thank you very much for the support

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by