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

조회 수: 7 (최근 30일)
Macauley
Macauley 2018년 1월 22일
답변: Steven Lord 2018년 1월 22일
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

답변 (1개)

Steven Lord
Steven Lord 2018년 1월 22일
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.

카테고리

Help CenterFile Exchange에서 Number games에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by