Home Database Mysql Tutorial Matlab中的矩阵用法2

Matlab中的矩阵用法2

Jun 07, 2016 pm 03:33 PM
matlab vector usage matrix

(1)特殊向量 t=[0:0.1:10] %产生从0~10的行向量,元素之间的间隔为0.1 t=linspace(n1,n2,n) %产生n1和n2之间线性均匀分布的n个数(默认n时,产生100个数) t=lonspace(n1,n2,n) %默认n时,产生50个数 (2)特殊矩阵 eye(m) %生成m阶单位矩阵 eye(m,n) %m阶

(1)特殊向量

     t=[0:0.1:10]    %产生从0~10的行向量,元素之间的间隔为0.1
     t=linspace(n1,n2,n)  %产生n1和n2之间线性均匀分布的n个数(默认n时,产生100个数)
     t=lonspace(n1,n2,n) %默认n时,产生50个数

(2)特殊矩阵

     eye(m) %生成m阶单位矩阵
     eye(m,n) %m阶单位矩阵的第n列
     eye(size(a)) %与矩阵a同等阶数的单位阵

(3)所有元素为1的矩阵(也叫全1矩阵)

     ones(n) %全1的n阶矩阵

     ones(size(A)) %与A同阶的全1矩阵
     ones(m,n) %m阶全1矩阵的第n列

(4)所有元素为0的矩阵(也叫全0矩阵)

     zeros(n)  %全0的n阶矩阵

     zeros(size(A)) %与A同阶的全0矩阵

     zeros(m,n)  %m阶全0矩阵的第n列

(5)空矩阵

       q=[] %空矩阵是一个特殊的矩阵,这在线性代数中是不存在的。不过,它可以用来删除矩阵的行与列。

        B(2,:)=[] %删除矩阵B的第2行  
        B(:,3)=[] %删除矩阵B的第3列

(6)随机数矩阵

    rand(m,n) %产生m×n矩阵,其中的元素是服从[0,1]上均匀分布的随机数;

   normrnd(mu,sigma,m,n)  %产生m×n矩阵,其中的元素是服从均值为mu、标准差为sigma的正态分布的随机数;

   exprnd(mu,m,n)   %产生m×n矩阵,其中的元素是服从均值为mu的指数分布的随机数;

   poissrnd(mu,m,n)  %产生m×n矩阵,其中的元素是服从均值为mu的泊松分布的随机数;

   unifrnd(a,b,m,n)    %产生m×n矩阵,其中的元素是服从区间[a,b]山均匀分布的随机数;

(7)随机置换

    randperm(n)  %产生1~n的一个随机全排列

    perms([1:n])  %产生1~n的所有全排列

(8)求矩阵的逆

    inv(a) %求矩阵a的逆

 (9)方阵b对应的行列式的值

   det(b) %方阵b对应的行列式的值

 

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
4 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
1671
14
PHP Tutorial
1276
29
C# Tutorial
1256
24
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.

Analyze the usage and classification of JSP comments Analyze the usage and classification of JSP comments Feb 01, 2024 am 08:01 AM

Classification and Usage Analysis of JSP Comments JSP comments are divided into two types: single-line comments: ending with, only a single line of code can be commented. Multi-line comments: starting with /* and ending with */, you can comment multiple lines of code. Single-line comment example Multi-line comment example/**This is a multi-line comment*Can comment on multiple lines of code*/Usage of JSP comments JSP comments can be used to comment JSP code to make it easier to read

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.

How to use fprintf in matlab How to use fprintf in matlab Sep 28, 2023 pm 04:28 PM

fprintf is a function in MATLAB used to format output. The basic syntax of fprintf is "fprintf(fileID, format, A)", where fileID is an identifier used to specify the file to be written. If you want to write data to the command window, you can use 1 as fileID The value of format is a string used to specify the output format, and A is the data to be output.

How to run m-file in matlab - Tutorial on running m-file in matlab How to run m-file in matlab - Tutorial on running m-file in matlab Mar 04, 2024 pm 02:13 PM

Do you know how to run m files in matlab? Below, the editor will bring you a tutorial on how to run m files in matlab. I hope it will be helpful to you. Let’s learn with the editor! 1. First open the matlab software and select the upper left "Open" the corner, as shown in the picture below. 2. Then select the m file to be run and open it, as shown in the figure below. 3. Press F5 in the window to run the program, as shown in the figure below. 4. We can view the running results in the command line window and workspace, as shown in the figure below. 5. You can also run the file by clicking "Run" directly, as shown in the figure below. 6. Finally, you can view the running results of the m file in the command line window and workspace, as shown in the figure below. The above is the matlab method that the editor brought to you

Exploring the History and Matrix of Artificial Intelligence: Artificial Intelligence Tutorial (2) Exploring the History and Matrix of Artificial Intelligence: Artificial Intelligence Tutorial (2) Nov 20, 2023 pm 05:25 PM

In the first article of this series, we discussed the connections and differences between artificial intelligence, machine learning, deep learning, data science, and more. We also made some hard choices about the programming languages, tools, and more that the entire series would use. Finally, we also introduced a little bit of matrix knowledge. In this article, we will discuss in depth the matrix, the core of artificial intelligence. But before that, let’s first understand the history of artificial intelligence. Why do we need to understand the history of artificial intelligence? There have been many AI booms in history, but in many cases the huge expectations for AI's potential failed to materialize. Understanding the history of artificial intelligence can help us see whether this wave of artificial intelligence will create miracles or is just another bubble about to burst. us

Introduction to Python functions: Usage and examples of abs function Introduction to Python functions: Usage and examples of abs function Nov 03, 2023 pm 12:05 PM

Introduction to Python functions: usage and examples of the abs function 1. Introduction to the usage of the abs function In Python, the abs function is a built-in function used to calculate the absolute value of a given value. It can accept a numeric argument and return the absolute value of that number. The basic syntax of the abs function is as follows: abs(x) where x is the numerical parameter to calculate the absolute value, which can be an integer or a floating point number. 2. Examples of abs function Below we will show the usage of abs function through some specific examples: Example 1: Calculation

Usage of WPSdatedif function Usage of WPSdatedif function Feb 20, 2024 pm 10:27 PM

WPS is a commonly used office software suite, and the WPS table function is widely used for data processing and calculations. In the WPS table, there is a very useful function, the DATEDIF function, which is used to calculate the time difference between two dates. The DATEDIF function is the abbreviation of the English word DateDifference. Its syntax is as follows: DATEDIF(start_date,end_date,unit) where start_date represents the starting date.

See all articles