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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 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)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
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

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.

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

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,

GE universal remote codes program on any device GE universal remote codes program on any device Mar 02, 2024 pm 01:58 PM

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

How to use Copilot to generate code How to use Copilot to generate code Mar 23, 2024 am 10:41 AM

As a programmer, I get excited about tools that simplify the coding experience. With the help of artificial intelligence tools, we can generate demo code and make necessary modifications as per the requirement. The newly introduced Copilot tool in Visual Studio Code allows us to create AI-generated code with natural language chat interactions. By explaining functionality, we can better understand the meaning of existing code. How to use Copilot to generate code? To get started, we first need to get the latest PowerPlatformTools extension. To achieve this, you need to go to the extension page, search for "PowerPlatformTool" and click the Install button

See all articles