MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

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

*No products are associated with this question.*

Answer by Shashank Prasanna
on 2 May 2013

Accepted answer

From FEX:

http://www.mathworks.com/matlabcentral/fileexchange/36791-random-walk-normal-vs-uniform

http://www.mathworks.com/matlabcentral/fileexchange/36763-random-walk

Show 3 older 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

## 0 Comments