Matlab基础学习

MATLAB basic learning

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(1)

分享兴趣,传播快乐,

增长见闻,留下美好!

亲爱的您,

这里是LearningYard学苑。

今天小编为大家带来的主题是Matlab基础学习,

欢迎您的用心访问,

本期推文阅读时常大约5分钟,请您耐心阅读。

Share interest, spread happiness,

Increase your knowledge and leave something beautiful!

Dear you,

This is LearningYard Academy.

The topic that the editor brings to you today is Matlab basic learning,

Welcome your visit,

This tweet usually takes about 5 minutes to read, please read it patiently.

功能介绍

Features

数值和符号计算

MATLAB以矩阵作为数据操作的基本单位,无需预先指定维数(动态定维),能够按照IEEE的数值计算标准进行计算,提供非常丰富的数值计算函数,方便了用户与提高了计算效率,命令与数学中的符号、公式非常接近,可读性强,容易掌握,这使得矩阵运算变得非常简洁、方便和高效。

科研绘图

MATLAB提供了丰富的绘图命令,能实现点、线、面与立体的一系列可视化操作。使用该软件绘图十分方便,可以绘制各种图像,囊括了2D和3D图形,也可以对图像进行修饰控制,以增强图像的表现效果。

语言汇编

MATLAB具有程序结构控制,函数调用,数据结构,输出输入,面向对象的程序设计语言特征。不仅简单易学,而且操作简便,对于数值结算,程序方针,计算机辅助设计等领域的人来说MATLAB是个理想的选择。

工具箱

工具箱是用MATLAB的基本语句编成的各种子程序集,用于解决某一方面的专门问题或实现某一类的新算法。工具箱可分为功能型和领域型工具箱。功能型工具箱主要用来扩充MATLAB的符号计算功能、图形建模仿真功能、文字处理功能以及与硬件实时交互功能,能用于多种学科。

Numerical and symbolic calculation

MATLAB uses the matrix as the basic unit of data operation. It does not need to specify the dimension in advance (dynamic fixed dimension). It can perform calculations in accordance with the IEEE numerical calculation standard. It provides a very rich numerical calculation function, which is convenient for users and improves calculation efficiency. The symbols and formulas in mathematics are very close, readable and easy to master, which makes matrix operations very concise, convenient and efficient.

Research drawing

MATLAB provides a wealth of drawing commands, which can realize a series of visual operations of point, line, surface and three-dimensional. It is very convenient to use this software for drawing. You can draw a variety of images, including 2D and 3D graphics, and you can also control the image modification to enhance the performance of the image.

Language assembly

Matlab has the characteristics of program structure control, function call, data structure, input and output, and object-oriented programming language. Not only is it easy to learn, but also easy to operate. MATLAB is an ideal choice for people in the fields of numerical settlement, program policy, and computer-aided design.

Toolbox

The toolbox is a collection of various subprograms compiled with the basic statements of MATLAB, which is used to solve a certain aspect of a special problem or realize a certain type of new algorithm. Toolboxes can be divided into functional and domain-based toolboxes. The functional toolbox is mainly used to expand MATLAB's symbolic calculation functions, graphical modeling and simulation functions, word processing functions, and real-time interaction with hardware. It can be used in a variety of disciplines.

操作界面

Operation interface

1、Matlab矩阵操作

矩阵的定义与构造

设置A=[1 2 3 5 8 5 4 6]

B=1:2:9

C=repmat(B,3,1) 重复

1. Matlab matrix operation

The definition and construction of matrix

Set A=[1 2 3 5 8 5 4 6]

B=1: 2: 9

C=repmat(B,3,1) repeat

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(2)

D=ones(2,4) 生成一个两行四列且值均为1的矩阵

D=ones(2,4) generates a matrix with two rows and four columns and the values are all 1.

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(3)

2、矩阵运算

A*B【矩阵转置】

A.*B【矩阵乘法】

A/B【矩阵对应数值相乘】

A./B【矩阵除法】

A^a【矩阵对应数值相除】

A.^a【矩阵的乘方】

A'【矩阵所有数值的乘方】

这里需要特别注意的是矩阵运算的点乘与点除,它们与普通的乘与除不同。点乘和点除表示两个矩阵相应位置的数值进行运算,而普通的乘与除是按照矩阵的乘除法规则进行计算。

以下为例:

2. Matrix operations

A*B【Matrix transpose】

A.*B【Matrix Multiplication】

A/B【Multiply the corresponding values of the matrix】

A./B【Matrix Division】

A^a【Divide the corresponding values of the matrix】

A.^a【Power of matrix】

A'【Power of all values of the matrix】

What needs special attention here is the dot multiplication and dot division of matrix operations, which are different from ordinary multiplication and division. Dot multiplication and dot division indicate that the values of the corresponding positions of the two matrices are calculated, while ordinary multiplication and division are calculated according to the rules of matrix multiplication and division.

Take the following as an example:

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(4)

3、矩阵的下标

设置A=magic(5)

3. The subscript of the matrix

Set A=magic(5)

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(5)

B=A(2,3)选取第二行,第三列

B=A(2,3) select the second row and the third column

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(6)

C=A(3,:)表示选取第三行所有列

C=A(3,:) means to select all the columns in the third row

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(7)

D=A(:,4)表示选取所有行的第四列

D=A (:, 4) means to select the fourth column of all rows

matlab零基础知识(萌说新语MATLAB入门学习之基础学习)(8)

4、矩阵行列交叉选取

其他关键词命令

下列代码为命令行窗口执行的特殊指令:

whos【查询数值属性】

clc【清除命令行窗口】

clear【清除变量】

clf【清除图形窗口】

cd【显示或者改变当前工作目录】

dir【显示当前目录或制定目录下的文件】

MATLAB有17个系统关键字,在命令行窗口输入指令iskeyword,即可得到关键字的列表,这里就不详细陈列了。

今天的分享就到这里了。

如果您对今天的文章有独特的想法,

欢迎给我们留言,让我们相约明天,

祝您今天过得开心快乐!

That's it for today's sharing.

If you have a unique idea about today’s article,

Welcome to leave us a message, let us meet tomorrow,

I wish you a happy day today!

,