Random Walks in MATLAB

Files which simulate random walks on a lattice and on a graph
7.3K Downloads
Updated 1 Sep 2016

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

These files show how MATLAB can be used to simulate random walks both on a lattice in N-dimensions and on a graph. The zip file contains the following:
RandDir: generates a random basis vector on a lattice
RandGraphMove: Given a connection matrix for a graph generates a random neighbouring node to the one currently occupied
RandomWalks: script file to demonstrate the use of these files using the SDE engine in the econometrics toolbox
RandomWalks_NoEconometrics: Version of the preivous file which does no rely on the econometrics toolbox
DemoData.mat: Mat file for graph example
Demo_Image.gif: Image file for graph example.

The files RandDir and RandGraphMove generate random motions for a random walk on a lattive and on a graph respectively. The Files RandomWalks and RandomWalks_NoEconometrics run through a series of examples firstly going through random walks in 1, 2 and 3 dimensions and then performing a random walk on the London Underground.

The file RandomWalks uses the SDE engine in the Econometrics toolbox to perfrom the random walks, whereas RandomWalks_NoEconometrics uses for loops instead. I've foudn the version using the econometrics toolbox to be faster.

Cite As

Mark Hoyle (2024). Random Walks in MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/22003-random-walks-in-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Networks in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.1

Updated license

1.2.0.0

Corrected image file

1.1.0.0

Now includes the main script published to html.

1.0.0.0