% % Written by: % -- % John L. Weatherwax 2007-09-10 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; close all; drawnow; A = [ -3 2 0 0 0 0; 0 -5 2 4 0 0; 3 0 0 -4 2 0; 0 3 0 0 -6 2; 0 0 -5 0 4 0; 0 0 3 0 0 -2; 1 1 1 1 1 1 ]; b = zeros(7,1); b(end)=1; p = A\b % compute the average: L = sum( [0,1,2,1,2,3] * p )