Starting diary file diary-06-Oct-2010.txt % % You need "temperature.mat" in your directory for the first part of this, % and you need "LU.mat" in your directory for the second part. load temperature A = A100; size(A) B = zeros(100,100); size(B) B(34,45) B(100,:) = 100; surfc(B) b = reshape(B,10000,1); size(b) t = A \ b; size(t) T = reshape(t,100,100); surfc(T) B(1,:) = 50; b = reshape(B,10000,1); t = A \ b; T = reshape(t,100,100); surfc(B) surfc(T) B(45:55,45:55) = 10; surfc(B) b = reshape(B,10000,1); t = A \ b; T = reshape(t,100,100); surfc(T) clear clc load LU whos A [L,U] = lugui(A) % Then click the diagonal elements as pivots L * U b x = A \ b y = L\b x = U \ y A * x b A*x-b A(2,2) = 1/2 A \ b [L,U] = lugui(A) % Click the diagonal elements as pivots, including the zero at the second step y = L \ b help lutx [L,U,p] = lugui(A) % Click the "suggested" pivots in red [L,U,p] = lutx(A) 5*4*3*2*1 factorial(5) A L * U Apermuted = A(p,:) L * U p p = p' b b(p) A(p,:) - L*U y = L \ b(p) x = U \ y A*x - b A(p,:) A(p, 1:5 ) I = [3 1 4 1 5 9] I([3 5]) = I([5 3]) A A(2,2) = 1/2 + 10^(-15) A(2,2) A(2,2) - .5 [L,U] = lugui(A) % Click on the diagonal elements, including the tiny one! y = L\b x = U \ y xx = A\b A * xx - b A * x - b [L,U,p] = lugui(A) % Click on the suggested pivots, the largest in the column y = L \ b(p) x = U \ y xx [L,U,p] = lutx(A) [L,U,P] = lu(A) diary off