Question: % Complete this program to perform the modified Gram - Schmidt procedure on % the columns of a matrix A . This entails doing a

% Complete this program to perform the modified Gram-Schmidt procedure on % the columns of a matrix A. This entails doing a forward sweep of Gram
% Schmidt followed by a reverse sweep. The advantage of this over the
% standard Gram-Schmidt procedure is much greater numerical stability,
% since reusing old columns that are only approximately orthogonal results
% in a "cascading error" effect. You wil1 need to implement each sweep.
% When completed, the program should output a before-error of 8.0**10-3
: (Matlab) or 1.5**10-2(Octave) and an after-error of 4.4***10-16, the
% latter of which is around machine precision (i.e: as good as we can hope for
% in finite-precision arithmetic). Please read the entire code before making
% changes.
clear all : This command erases past variables & other data
format compact : This suppresses extra Iines in the output
A=zeros(24,17); A is a matrix of size 24 by 17, initially a zero matrix
% now we will fill in the entries in A in a somewhat random way
Efor i=1:24
for j=1:17
A(i,j)=1i??2+j2
end
end
: forward cycle of Gram-Schmidt
for i=1:17
for j=1:(i-1)
this)
end
A(:,i)=A(:,i); normalizing the ith col of A (modify this)
end
residual_error_before =max(max(?abs(A'**A-eye(17)))); don't modify this!
% reverse cycle of Gram-Schmidt
for i=17:-1:1
for j=17:-1:(i+1)
A(:,i)=A(;,i); (modify this)
end
A(:,i)=A(:,i);% renormalizing the ith col of A(modify this)
end
7
8 residual_error_after =max(max(?abs(A'**A-eye(17))));
9% By seeing how close A'**A is to the 1717 identity matrix, we can get a
0 sense of "how" orthogonal the columns of A are after the procedure.
 % Complete this program to perform the modified Gram-Schmidt procedure on

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!