comment">% Create and solve model</span>
cvx_begin
    variable <span class="string">P(n,n)</span> <span class="string">symmetric</span>
    minimize(norm(P - (1/n)*ones(n)))
    P*ones(n,1) == ones(n,1);
    P &gt;= 0;
    P(E==0) == 0;
cvx_end
e = flipud(eig(P));
r = max(e(2), -e(n));

<span class="comment">% Display results</span>
disp(<span class="string">'------------------------------------------------------------------------'</span>);
disp(<span class="string">'The transition probability matrix of th