Notes on Matlab code for linear algebra (2) Row Space, zero space

Source: Internet
Author: User
Continue today and try to add some examples as simple content: % % row space base: we look at the matrix from the line perspective. In more information about the code description, we simply use yesterday's code. % CODE % functionBrowba

Continue today and try to add some examples as simple content: % % row space base: we look at the matrix from the line perspective. In more information about the code description, we simply use yesterday's code. % CODE % function B = rowba

Continue today. Try to add some examples

Still simple content:

% %

The basis of the row space: view the matrix from the perspective of the row. More information is provided in the Code description, which simply utilizes the code of yesterday.

% CODE %

Function B = rowbasis ()


% Rowbasis base of the row space
%
% B = rowbasis (A) returns A group of bases in the row space of.
% Is represented by Column B
% A's row space is equivalent to A's transpose column space
% Rowbasis: Find the linear irrelevant
Before %, r indicates the rank of.
%


B = colbasis (');

%

> A = [, 1;, 2;, 4]


A =


1 1 1
1 3 2
2 3 4


> Rowbasis ()


Ans =


1 1 2
1 3 3
1 2 4

% %

The basis of zero space: the Code of this zero space is worth looking at, reflecting the basic idea of column meaning in linear algebra.

You may not know what the code is. A simple statement may contain many operations.

I like to give an example when I don't quite understand it. Let's take a look at the code in one sentence. Note that

The column in the zero space indicates the linear combination of columns in the matrix that constitute the zero vector. The Code uses many methods to form a matrix.

% CODE %

Function N = nulbasis ()


% Nulbasis the base of the zero space.
%
% N = nulbasis (A) returns A group of bases for the zero space of A in the N column.
% Contains n-r special solutions for Ax = 0
% Freecol is a free column.
%
% Example:
%
%> A = [1 2 0 3;
% [0 0 1 4];
%
%> N = nulbasis ()
%
% N = [-2-3]
% [1 0]
% [0-4]
% [0 1]
%


[R, pivcol] = rref (A, sqrt (eps); % precision sqrt (eps) = 1.4901e-008
[M, n] = size ();
R = length (pivcol );
Freecol = 1: n;
Freecol (pivcol) = []; % column of the Principal Component
N = zeros (n, n-r );
N (freecol,:) = eye (n-r); % the free column number is assigned to the row in the zero space by the unit matrix.
N (pivcol,:) =-R (1: r, freecol); % inverse number of values of the simplified step matrix in the column where the principal component is located
% In this way, the zero vector can be obtained.
% This method is close to the algorithm for manually finding zero space

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.