[Master Index] [Index for PublicToolbox/regutools]

# mgs

## (PublicToolbox/regutools/mgs.m in BrainStorm 2.0 (Alpha))

### Function Synopsis

    Q = mgs(A)

### Help Text

    MGS Modified Gram-Schmidt orthonormalization.

     Q = mgs(A)

     Applies the modified Gram-Schmidt process to the matrix A
     (assuming that A has full rank), and returns a matrix Q whose
     columns are orthonormal and span the range of A.

### Cross-Reference Information

This function is called by

    get_l                              C:\BrainStorm_2001\PublicToolbox\regutools\get_l.m

### Listing of function C:\BrainStorm_2001\PublicToolbox\regutools\mgs.m

    function Q = mgs(A)
    %MGS Modified Gram-Schmidt orthonormalization.
    %
    % Q = mgs(A)
    %
    % Applies the modified Gram-Schmidt process to the matrix A
    % (assuming that A has full rank), and returns a matrix Q whose
    % columns are orthonormal and span the range of A.

    % Per Christian Hansen, UNI-C, 04/11/90.

    Q = A; [m,n] = size(A);

    for k=1:n
       Q(:,k) = Q(:,k)/norm(Q(:,k));
       Q(:,k+1:n) = Q(:,k+1:n) - Q(:,k)*(Q(:,k)'*Q(:,k+1:n));
    end

Produced by color_mat2html, a customized BrainStorm 2.0 (Alpha) version of mat2html on Tue Oct 12 12:05:14 2004
Cross-Directory links are: ON