% Starting diary file diary-08-Nov-2010.txt load grades grades plot(grades,'.') median(grades) sort(grades) hist(grades,0:5:100) A = [ 3 1 ; -2 4] b = [9;8] A \ b x = [0;0] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] A\b x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] format long x x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] x = [ (9-x(2))/3 ; (8+2*x(1))/4 ] format short d = diag(A) A D = diag(d) C = A - D x =[0;0] x = (b-C*x) ./ d x = (b-C*x) ./ d % ... about 30 repetitions x = (b-C*x) ./ d residual = A*x - b x =[0;0] x = (b-C*x) ./ d, resnorm = norm(A*x-b) x = (b-C*x) ./ d, resnorm = norm(A*x-b) % ... about 30 repetitions x = (b-C*x) ./ d, resnorm = norm(A*x-b) x = (b-C*x) ./ d, resnorm = norm(A*x-b) resnorm = 7.1693e-006 clc clear load roomtemp spy(A) A(1:10,1:10) whos B = reshape(b,100,100); surfc(B) t = A \ b; surfc(reshape(t,100,100)),shg max(t) ans = 37 37 * 9/5 + 32 clc d = diag(A); d C = A - diag(d); spy(C) n = 10000 x = zeros(n,1); surfc(reshape(x,100,100)),shg x = (b-C*x) ./ d; resnorm = norm(A*x-b) surfc(reshape(x,100,100)),shg x = (b-C*x) ./ d; resnorm = norm(A*x-b) surfc(reshape(x,100,100)),shg jacobitest1 % hit space bar for each iteration jacobitest2 % runs 20000 iterations, plotting at each 100th one. figure,spy(A) [L,U,P] = lu(A); spy(L+U) clc jacobitest3 % runs 20000 iterations with no output, gives resvec size(resvec) plot(resvec) semilogy(resvec) x = zeros(n,1); [x,flag,relres,iter,resvec] = pcg(A,b,10^(-8),10000); norm(A*x-b) iter hold on semilogy(resvec,'r') clc A = randn(100,100); b = randn(100,1); x = A\b; norm(A*x-b) jacobitest figure semilogy(resvec) diary off