I'm trying to enter gram schmidt into matlab for C but it doesn't work. can anyone help please it work for B for me but i don't how to get C. pretty much I'm trying get C equation into a calculator if that make sense.
%Change value of a, b and c as per the requirement
%Here c value is not given so i assumed c=[1;1;1];
%%Matlab code for Gram Schmidt orthogonalization
clear all
close all
%Provide your original a, b and c vectors
a=[1; 1; 2];
b=[1; -1; 0];
c=[1; 1; 1];
%printing the vectors
fprintf('Vector a =\n')
disp(a)
%printing the vectors
fprintf('Vector b =\n')
disp(b)
%printing the vectors
fprintf('Vector c =\n')
disp(c)
%Gram Schmidt process
%Let orthogonal vectors can be represents as A, B and C
A=a;
B=b-((A'*b)/(A'*A))*A;
C=c-((A'*c)/(A'*A))*A-((B'*c)/(B'*B))*B;
%printing the results
fprintf('After Gram Schmidt orthogonalization\n')
%printing the vectors
fprintf('Vector A =\n')
disp(A)
%printing the vectors
fprintf('Vector B =\n')
disp(B)
%printing the vectors
fprintf('Vector C =\n')
disp(C)
%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%
I'm trying to enter gram schmidt into matlab for C but it doesn't work. can anyone help please it...