Daniel@0: function M = softeye(K, p) Daniel@0: % SOFTEYE Make a stochastic matrix with p on the diagonal, and the remaining mass distributed uniformly Daniel@0: % M = softeye(K, p) Daniel@0: % Daniel@0: % M is a K x K matrix. Daniel@0: Daniel@0: M = p*eye(K); Daniel@0: q = 1-p; Daniel@0: for i=1:K Daniel@0: M(i, [1:i-1 i+1:K]) = q/(K-1); Daniel@0: end