% Sample script for typical in-class first-try to implement % Graham Schmidt Orthogonalization in one special example. % The start vectors are typical for students choices..... % % All rights reserved. Original version: Nov 2003 % Matthias Kawski http://math.asu.edu/~kawski v1=[1 2 3]' v2=[3 4 5]' v3=[5 7 10]' check_rank=rref([v1 v2 v3]) u1=v1/sqrt(v1'*v1) w2=v2-(u1'*v2)*u1 u2=w2/sqrt(w2'*w2) w3=v3-(u1'*v3)*u1-(u2'*v3)*u2 u3=w3/sqrt(w3'*w3) U=[u1 u2 u3] check=U'*U