Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions