View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Random Walks in MATLAB

4.3 | 3 ratings Rate this file 55 Downloads (last 30 days) File Size: 1.69 MB File ID: #22003 Version:
image thumbnail

Random Walks in MATLAB


Mark Hoyle (view profile)


05 Nov 2008 (Updated )

Files which simulate random walks on a lattice and on a graph

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

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.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
30 Aug 2013 Binh

Binh (view profile)

03 Apr 2013 yan Chen


27 Jul 2010 Kaybe Loughran

Hey this is really cool. One question, though. I'm trying to use the same principle on a different transportation system. What do the different parts of the DemoData represent?

Comment only

07 Jan 2009 1.1

Now includes the main script published to html.

07 Jan 2009 1.2

Corrected image file

01 Sep 2016

Updated license

Contact us