I need to create a 40x40 transition matrix for a board game.

7 views (last 30 days)
I need to create a 40x40 transition matrix for a board game. Taking into account all possible moves from 2-12 dictated by a pair of fair dice, but it must loop after 40 back to 1 upwards again. I am struggling to compute this in Matlab. I have made one by hand, but inputting 1600 values will take too long so I have tried to make it quickly, however I keep getting errors in all of my commands.
some of what I have been using has been:
m=zeros(40,40)
for i=1:40 m(i,i+2)=... . . . end for all the values of the moves from 2 spaces up to 12 I can't seem to make the transition matrix circular
if anyone could help it would be much appreciated

Answers (1)

Steven Lord
Steven Lord on 22 Jan 2018
The 'circul' option for the gallery function may be of use to you.
A = gallery('circul', [1:5 zeros(1, 5)])
If I've guessed right about which board game you're modeling, depending on how simplified or realistic a version you want to model this presentation may be of interest to you.

Categories

Find more on Number games in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!