% Linear Algebra: Theory and Applications % Ward Cheney & David Kincaid % JBPub.com (c) 2008 % File: rich1.m % Example 8.3.1 % format long G = [0.0,0.3,0.2;0.3,0.0,0.1;0.2,0.1,0.0] b = [7.0;5.0;3.0] A=eye(3)-G y=A\b x = [0.0;0.0;0.0]; z = [0,x'] for k=1:100 x = G*x + b; z = [k,x'] e = abs(y - x); norm(e) end