MATLAB Answers

Locks

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

Products

No products are associated with this question.

1 Answer

Answer by Shashank Prasanna
on 2 May 2013
 Accepted answer

  6 Comments

Cedric Wannaz
on 2 May 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.

Cedric Wannaz
on 2 May 2013
 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
on 2 May 2013

I will try that, thank you very much for the support


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today