mgrscho

Modified Gram-Schmidt orthogonalization procedure.
4.4K Downloads
Updated 2 Oct 2006

View License

-For a basis of fundamentals on classical Gram-Schmidt process, procedure and its origin. Please see the text of the m-file cgrsho you can download from:
www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=12465

The classical Gram-Scmidt algorithm is numerically unstable, mainly because of all the successive subtractions in the order they appear. When this process is implemented on a computer, then the vectors s_n are not quite orthogonal because of rounding errors. This loss of orthogonality is particularly bad; therefore, it is said that the (naive) classical Gram-Schmidt process is numerically unstable. If we write an algorithm based on the way we developed the Gram-Schmidt iteration (in terms of projections), we get a better algorithm.

The Gram-Schmidt process can be stabilized by a small modification. Instead of computing the vector u_n as,

u_n = v_k - proj_u_1 v_n - proj_u_2 v_n -...- proj_u_n-1 v_n

it is computed as,

u_n = u_n ^n-2 - proj_u_n-1 u_n ^n-2

This series of computations gives the same result as the original formula in exact arithmetic, but it introduces smaller errors in finite-precision arithmetic. A stable algorithm is one which does not suffer drastically from perturbations due to roundoff errors. This is called as the modified Gram-Schmidt orthogonalization process.

There are several different variations of the Gram-Schmidt process including classical Gram-Schmidt (CGS), modified Gram-Schmidt (MGS) and modified Gram-Schmidt with pivoting (MGSP). MGS economizes storage and is generally more stable than CGS.

The Gram-Schmidt process can be used in calculating Legendre polynomials, Chebyshev polynomials, curve fitting of empirical data, smoothing, and calculating least square methods and other functional equations.

Input:
A - matrix of n linearly independent vectors of equal size. Here, them
must be arranged as columns.

Output:
Matrix of n orthogonalized vectors.

Cite As

Antonio Trujillo-Ortiz (2024). mgrscho (https://www.mathworks.com/matlabcentral/fileexchange/12495-mgrscho), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Numerical Integration and Differential Equations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0

Text was improved.