clc; rng('shuffle'); %new seed for random numbers A = rand(5, 1); B = rand(5, 1); C = rand(5, 1); %Now normalize A = A/sqrt(A'*A); AxB = A'*B Bnew = B - AxB*A; Bnew = Bnew/sqrt(Bnew'*B); %Normalize AcorrB = A'*Bnew pause; AxC = A'*C BxC = Bnew'*C Cnew = C - AxC*A - BxC*Bnew; Cnew = Cnew/sqrt(Cnew'*Cnew); %Normalize AcorrC = A'*Cnew BcorrC = Bnew'*Cnew