Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

linalg::orthog

Orthogonalization of vectors

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

linalg::orthog(S, <Real>)

Description

linalg::orthog(S) orthogonalizes the vectors in S using the Gram-Schmidt orthogonalization algorithm.

The vectors in S are orthogonalized with respect to the scalar product linalg::scalarProduct.

If O is the returned set, then the vectors of O span the same subspace as the vectors in S, and they are pairwise orthogonal, i.e.: for all with .

The vectors returned are not normalized. To normalize them use map(O, linalg::normalize).

For an ordered set of orthogonal vectors, S should be a list.

The vectors in S must be defined over the same component ring.

The component ring of the vectors in S must be a field, i.e., a domain of category Cat::Field.

If you use the Real option, linalg::orthog computes an orthogonal basis using a real scalar product in the orthogonalization process.

Examples

Example 1

The following list of vectors is a basis of the vector space 3:

MatR := Dom::Matrix(Dom::Real):
S := [MatR([2, 1, 0]), MatR([-3, 1, 1]), MatR([-1, -1, -1])]

The Gram-Schmidt algorithm then returns an orthogonal basis for 3. We get an orthonormal basis with the following input:

ON:= linalg::orthog(S)

The vectors can be normalized using linalg::normalize:

map(ON, linalg::normalize)

We may also build a matrix from the vectors in S an apply linalg::orthog to this matrix. The result is the matrix whose columns are given by the above elements of the list ON:

A:= S[1].S[2].S[3]

linalg::orthog(A)

Example 2

The orthogonalization of the vectors:

T := {matrix([[-2, 5, 3]]), matrix([[0, 2, 1]])}

gives:

linalg::orthog(T)

Example 3

The result of linalg::orthog is a list or set of linearly independent vectors, even if the input contains linearly dependent vectors:

MatQ := Dom::Matrix(Dom::Rational):
S := [MatQ([2, 1]), MatQ([3, 4]), MatQ([-1, 1])]

linalg::orthog(S)

Example 4

Compute an orthogonal basis of this matrix:

A := matrix([[a, 1], [1, a]]):
linalg::orthog(A)

To avoid complex conjugates, use the Real option:

linalg::orthog(A, Real)

Parameters

S

A set or list of vectors of the same dimension (a vector is an n×1 or 1 ×n matrix of a domain of category Cat::Matrix) or a matrix

Options

Real

Avoid using a complex scalar product in the orthogonalization process.

Return Values

Set or a list of vectors, respectively.

Was this topic helpful?