% Sample script for typical in-class second-try to implement % Graham Schmidt Orthogonalization in one special example. % Now using some matrix language. % % All rights reserved. Original version: Nov 2003 % Matthias Kawski http://math.asu.edu/~kawski V=5-round(10*rand(7,4)) check=rref(V) Q=V w=V(:,1) Q(:,1)=w/sqrt(w'*w) w=V(:,2) w=w-(Q(:,1)'*w)*Q(:,1) Q(:,2)=w/sqrt(w'*w) w=V(:,3) w=w-(Q(:,1)'*w)*Q(:,1)-(Q(:,2)'*w)*Q(:,2) Q(:,3)=w/sqrt(w'*w) w=V(:,4) w=w-(Q(:,1)'*w)*Q(:,1)-(Q(:,2)'*w)*Q(:,2)-(Q(:,3)'*w)*Q(:,3) Q(:,4)=w/sqrt(w'*w) check=Q'*Q