probUp = 0.1;
probDown = 0.1;
probStay = 1-probUp-probDown;
payoffs = [9; 10; 15; 20; 25; 40];
numStates = length(payoffs);
timeHorizon = 12;
discount = 0.99;
transMatrix = diag(probStay*ones(numStates,1)) + ...
    diag(probUp*ones(numStates-1,1),+1) + ...
    diag(probDown*ones(numStates-1,1),-1);
transMatrix(1,1) = transMatrix(1,1)+probDown;
transMatrix(end,end) = transMatrix(end,end)+probUp;
[valueTable, decisionTable] = FindPolicyFiniteRW(transMatrix, payoffs, ...
    timeHorizon, discount);
display(decisionTable);