Home Database Mysql Tutorial 有关线性代数的Matlab代码笔记(2)行空间、零空间

有关线性代数的Matlab代码笔记(2)行空间、零空间

Jun 07, 2016 pm 03:07 PM
matlab code space notes linear algebra

今天继续,尝试加入一些范例 依然是简单的内容: %%%%%%%%%%%%%%%%%%%%% 说明 %%%%%%%%%%%%%%%%%%% 行空间的基 :按行的角度来看待矩阵,更多介绍在代码说明里,简单的利用了昨天的代码。 %%%%%%%%%%%%%%%%%%%%% CODE %%%%%%%%%%%%%%%%%% function B = rowba

今天继续,尝试加入一些范例

依然是简单的内容:

%%%%%%%%%%%%%%%%%%%%%说明 %%%%%%%%%%%%%%%%%%%

行空间的基:按行的角度来看待矩阵,更多介绍在代码说明里,简单的利用了昨天的代码。

%%%%%%%%%%%%%%%%%%%%%CODE %%%%%%%%%%%%%%%%%%

function B = rowbasis(A)


% rowbasis  行空间的基 
%
% B = rowbasis(A) 返回A的行空间的一组基
% 以B的列表示
% A的行空间相当于A的转置的列空间
% rowbasis 找出A'中线性无关的 
% 前r列,r代表A的秩
%


B = colbasis(A');

%%%%%%%%%%%%%%%%%%%%%范例 %%%%%%%%%%%%%%%%%%

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


A =


     1     1     1
     1     3     2
     2     3     4


>> rowbasis(A)


ans =


     1     1     2
     1     3     3
     1     2     4

%%%%%%%%%%%%%%%%%%%%%说明 %%%%%%%%%%%%%%%%%%%

零空间的基:这个零空间的代码值得好好看看,体现了线性代数里关于列意义的基本思想。

直接看去你可能会不知道这些代码在干什么。因为一个简单的语句可能包含了很多操作。

我自己不太明白的时候是喜欢举个例子,把代码一句一句执行来看看的。这里要注意的是

零空间里的列指示了矩阵里构成零向量的列的线性组合。而代码里用到了很多构成矩阵的办法。

%%%%%%%%%%%%%%%%%%%%%CODE %%%%%%%%%%%%%%%%%%

function N = nulbasis(A)


% nulbasis  零空间的基.
%
% N = nulbasis(A) 在N的列中返回A的零空间的一组基
% 包含了Ax=0的n-r个特殊解 
% freecol是自由列.
%
% Example:
%
% >> A = [1 2 0 3;
%        [0 0 1 4];
%
% >> N = nulbasis(A)
%
%    N = [-2  -3]   
%        [ 1   0]
%        [ 0  -4]
%        [ 0   1]
%


[R, pivcol] = rref(A, sqrt(eps));%精度sqrt(eps)=1.4901e-008
[m, n] = size(A);
r = length(pivcol);
freecol = 1:n;
freecol(pivcol) = [];%主元所在列
N = zeros(n, n-r);
N(freecol, : ) = eye(n-r);%由自由列序号给零空间的行按单位矩阵赋值
N(pivcol,  : ) = -R(1:r, freecol);%主元所在列赋行简化阶梯矩阵对应值相反数
                                  %这样组合能得到零向量
                                  %这个方法接近我们手动求零空间的算法


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

How to solve win7 driver code 28 How to solve win7 driver code 28 Dec 30, 2023 pm 11:55 PM

Some users encountered errors when installing the device, prompting error code 28. In fact, this is mainly due to the driver. We only need to solve the problem of win7 driver code 28. Let’s take a look at what should be done. Do it. What to do with win7 driver code 28: First, we need to click on the start menu in the lower left corner of the screen. Then, find and click the "Control Panel" option in the pop-up menu. This option is usually located at or near the bottom of the menu. After clicking, the system will automatically open the control panel interface. In the control panel, we can perform various system settings and management operations. This is the first step in the nostalgia cleaning level, I hope it helps. Then we need to proceed and enter the system and

What to do if the blue screen code 0x0000001 occurs What to do if the blue screen code 0x0000001 occurs Feb 23, 2024 am 08:09 AM

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? Mar 21, 2024 pm 09:30 PM

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu Mar 12, 2024 am 10:40 AM

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

The difference between scilab and matlab The difference between scilab and matlab Dec 11, 2023 am 11:13 AM

The difference between scilab and matlab: 1. Annotation symbols; 2. Representation of preset variables; 3. Usage of operators; 4. Definition and calling of matrices; 5. Editing and execution of programs; 6. Data types; 7. Functions Library; 8. Graphical interface; 9. Community support and ecosystem; 10. Cross-platform compatibility; 11. Price. Detailed introduction: 1. Comment symbols. In Scilab, comments are guided by "//", while in Matlab, comments are guided by "%"; 2. Representation of preset variables in Scilab, etc.

The computer frequently blue screens and the code is different every time The computer frequently blue screens and the code is different every time Jan 06, 2024 pm 10:53 PM

The win10 system is a very excellent high-intelligence system. Its powerful intelligence can bring the best user experience to users. Under normal circumstances, users’ win10 system computers will not have any problems! However, it is inevitable that various faults will occur in excellent computers. Recently, friends have been reporting that their win10 systems have encountered frequent blue screens! Today, the editor will bring you solutions to different codes that cause frequent blue screens in Windows 10 computers. Let’s take a look. Solutions to frequent computer blue screens with different codes each time: causes of various fault codes and solution suggestions 1. Cause of 0×000000116 fault: It should be that the graphics card driver is incompatible. Solution: It is recommended to replace the original manufacturer's driver. 2,

How to modify coordinates in matlab How to modify coordinates in matlab Dec 15, 2023 am 10:40 AM

In MATLAB, you can use the "set" function to modify the axis properties of a graph. Detailed introduction: 1. Modify the range of the coordinate axis: set(gca, 'XLim', [0 10], 'YLim', [0 10]); 2. Modify the label of the coordinate axis: set(gca, 'XLabel', 'My X-axis', 'YLabel', 'My Y-axis'); 3. Modify the scale of the coordinate axis, etc.

See all articles