randomwalk

Create a random walk in any number of dimensions
514 download
Aggiornato 1 mag 2018

Visualizza la licenza

randomwalk - create random walk in arbitrary dimension
P = randomwalk(N, D) produces a N-by-D matrix P with the positions of a random walk of N steps in D dimensions, starting from (0,..,0). P(K,:) holds the coordinates of the position at step K. Each step from one position to the next is +1 or -1 along a random dimension.
With a third logical argument, randomwalk(N, D, true) creates a plot of the random walk in a new figure.

Examples:
P = randomwalk(2, 10) % -> for example
% P = [0 0 ; 1 0 ; 1 1 ; 2 1 ; 2 0 ; 2 -1 ; 3 -1 ; 3 -2 ; 2 -2 ; 2 -1]
randomwalk(1000,4,true) ; % create a plot

Cita come

Jos (10584) (2024). randomwalk (https://www.mathworks.com/matlabcentral/fileexchange/67160-randomwalk), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2017b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Random Number Generation in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0