% % Written by: % -- % John L. Weatherwax 2007-07-01 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; M = [ 0 1 1 1 0 ; 0 0 1 0 1 ; 0 0 0 1 1 ; 0 1 0 0 0 ; 1 0 0 1 0 ; ]; M^2 Pm = M + M^2 sum( Pm, 2 )