% Matlab diary from cs110a class #11, Jan 28 2005. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. load ucsbweb U{1} U{2:5} whos G U{1} U{3} load ucsbweb2 whos U spy(G) rs = sum(G'); size(rs) max(rs) [val, ind] = max(rs) U{3} a = rand(3) sum(a) sum(a') b b(3)=5 U{3} U(3) isstr(U{3}) isstr(U(3)) V = U(3) V{1} clc whos e = ones(5,1) e * e' ones(5,5) x = rand(5,1) sum(x) e' * x e' x clc help pagerank xncm = pagerank(U,G); size(xncm) sum(xncm) clc whos clc c = sum(G); size(c) c(3) D = diag( 1./c); f = find(c==0) G(:,f) = 1; c = sum(G); find(c==0) D = diag(sparse(1./c)); spy(D) n=1000; I = speye(n); e = ones(n,1); p = .85; delta = (1-p)/n x = (I - p*G*D) \ (delta*e); x = A \ b; sum(x)