matalb矩阵计算(MATLAB矩阵计算)
MATLAB矩阵及运算

重点
y矩阵中每一列最大的值
y向量中最大的值
最大值的位置
最大值的位置
注意:输入矩阵类型不同, 则执行的操作不同。
2.1.4 函数
因为matlab函数太多,所以要养成使用help
命令,得到有关函数的具体用法:
例:help max
2.1表达式
表达式
(即语句):将变量、数值、函 数用操作符连接起来,就构成了表达式 。
应用:可以和其它语言程序进行数据通信。 举例:
通过MATLAB提供的函数产生矩阵
用内部函数可生成一些特殊矩阵 (函数见书上P50)
重点
通过MATLAB提供的函数产生矩阵
1、单位矩阵(
E方阵)和广义单位矩阵的
产生
重点
通过MATLAB提供的函数产生矩阵
2、随机数矩阵的产生
随机数的产生常常用在控制系统仿真以 及信号分析,是一个非常重要的手段。 MATLAB提供了很好的随机数产生函数: rand() randn()
A/ B A*B
1
A\B A
重点
1
*B
Matlab右除法表示形式:
C=A/B 或 C=A * i n v ( B )
Matlab左除法表示形式: C=A\B 或 C=i n v ( A ) * B
注意:只有行列式不为0的方阵才存在逆阵!!!
矩阵元素的右除、左除
a1 A a3 a2 a4
2)变量名由字母、数字和下划线构成。第一个 字母必须是英文字母。 3)有字符个数限制(版本5.0 :最多31个字符)
2.1.2 变量
MAT
重点
(注意大小写!)
i或j: 错误:5+j7
第三章_matlab矩阵运算

主讲:陈孝敬 E-mail:chenxj9@
第3章
数学运算
主要内容:
①矩阵运算; ②矩阵元素运算;
3.1 矩阵运算
3.1.1 矩阵分析
1.向量范式定义:
x x x
1
n
k 1
xk
2 k
2
k 1 n
x
n
1/ 2
k 1
xk
向量的3种常用范数及其计算函数 在MATLAB中,求向量范数的函数为: (1) norm(V)或norm(V,2):计算向量V的2—范数。 (2) norm(V,1):计算向量V的1—范数。 (3) norm(V,inf):计算向量V的∞—范数。
3.1.2 矩阵分解
矩阵分解:把矩阵分解成比较简单或对它性质比较熟悉的若干 矩阵的乘积的形式;
1.Cholesky分解: Cholesky分解是把对称正定矩阵表示成上三角矩阵的转 置与其本身的乘积,即:A=RTR,在Matlab中用函数chol 来计算Cholesky分解 例3-13 求矩阵A=pascal(4)的Cholesky分解, A=pascal(4) R=chol(A) R’*R
例3-18.求解方程组
x1 x2 3 x3 x4 1 3 x1 x2 3 x3 4 x4 4 x 5x 9 x 8x 0 2 3 4 1
解 先用Matlab函数null求出对应的齐次线性方程组的基础解 系,再利用其系数矩阵的上、下三角阵求出方程组的一个特解, 这样即可得到该方程组的通解,程序如下: >> >> >> >> >> >> A=[1 1 -3 -1;3 -1 -3 4;1 5 -9 -8]; b=[1 4 0] ′; format rat C=null(A , ′r′); %求基础解系 [L,U]=lu(A); %A=LU,L为上三角阵,U为下三角阵 X0= U\(L\b) %用LU求出一个齐次方程的特解
Matlab矩阵运算基础数值运算

data =
1.1000 3.0000 4.0000
2.3000 2.0000 1.0000
.
13
3.2 矩阵运算
主要介绍矩阵的算术运算、关系运算、逻辑 运算和常用的有关矩阵的其他运算(矩阵的 逆,矩阵的秩、矩阵的分解等)。
.
14
3.2.1 矩阵的算术运算
1、矩阵的加(+)减(-)运算:
A±B 矩阵A和矩阵B的和与差,即矩阵相应 位置的元素相加、减。
>> A=magic(3)
D=
A= 816
0.5492 0.2421 -0.6520 0.9075
357
1.0047 -0.4941
492
>> C*D
>> B=inv(A)
ans =
B=
1.0000 0.0000
0.1472 -0.1444 0.0639
0.0000 1.0000
-0.0611 0.0222 0.1056
~ A 对单个矩阵或标量进行取反运算,结果是0-1矩阵。
.
28
3.2.3 矩阵的逻辑运算
例3-11 1 0 3
1 2 0
A2.6 1 2, B0 5 0
0 3 1
1 0 1
计算 A&B, A|B, ~A Nhomakorabea.
29
3.2.4 矩阵函数
1、矩阵的共轭
MATLAB中求矩阵的共轭矩阵的函数是conj,其 调用格式为:
除或浮点溢出都不按错误处理,只是给出警告信息,同时用“Inf”
标记。
.
20
3.2.1 矩阵的算术运算
4、 矩阵的幂运算:^ A^B A的B次方。
matlab矩阵与线性变换与计算

05
实例演示
矩阵的基本操作实例
矩阵的创建
使用方括号[],例如A = [1 2; 3 4]。
矩阵的加法
使用加号+,例如B = [5 6; 7 8],则A + B = [6 8; 10 12]。
矩阵的数乘
使用标量乘法,例如2 * A = [2 4; 6 8]。
矩阵的元素运算
使用点运算符.,例如A.^2 = [1 4; 9 16]。
矩阵计算实例
行列式计算
使用det函数,例如det(A) = -2。
行最简形式
使用rref函数,例如rref(A) = [1 0; 0 1]。
矩阵的逆
使用inv函数,例如inv(A) = [-2 -3; 1.5 0.5]。
矩阵的转置
使用'运算符,例如A' = [1 3; 2 4]。
THANKS
感谢观看
Matlab矩阵与线性变换与计 算
• Matlab矩阵基础 • 线性变换 • 矩阵计算 • Matlab中的矩阵与线性变换操作 • 实例演示
01
Matlab矩阵基础
矩阵的定义与表示
矩阵是一个由数字组 成的矩形阵列,行和 列的数量可以不同。
还可以使用分号来分 隔行,以创建多行矩 阵。
在Matlab中,可以 使用方括号[]来创建 矩阵,并使用逗号分 隔行内的元素。
矩阵的基本操作
加法
将两个矩阵的对应元素相加。
减法
将一个矩阵的对应元素减去另 一个矩阵的对应元素。
数乘
将一个标量与矩阵中的每个元 素相乘。
转置
将矩阵的行和列互换。
特殊类型的矩阵
对角矩阵
除了主对角线上的元素外,其他元素都为零 的矩阵。
第2章 matlab矩阵及其运算

第2章 MATLAB 矩阵及其运算
2.1.2 MATLAB常用数学函数
MATLAB提供了许多数学函数,函
数的自变量规定为矩阵变量,运算法
则是将函数逐项作用于矩阵的元素上, 因而运算的结果是一个与自变量同维
数的矩阵。
11/128 MALAB 7.X程序设计
第2章 MATLAB 矩阵及其运算
1. 三角函数 • sin 正弦函数 • asin 反正弦函数 • cos 余弦函数 • tan 正切函数 • cot 余切函数 • sec 正割函数 • csc 余割函数
在MATLAB命令口输入命令:
x=1+2i; y=3-sqrt(17); z=(cos(abs(x+y))-sin(78*pi/180))/(x+abs(y))
其中pi和i都是MATLAB预先定义的变量,分别
代表代表圆周率π和虚数单位。 输出结果是:
z =
-0.3488 + 0.3286i
10/128 MALAB 7.X程序设计
18/128 MALAB 7.X程序设计
第2章 MATLAB 矩阵及其运算
rem与mod的区别
rem(x,y)=x-y.*fix(x./y)
mod(x,y)=x-y.*floor(x./y)
eg: >>x=5;y=3; >>y1=rem(x,y),y2=mod(x,y) >> x=-5;y=3; >>y1=rem(x,y),y2=mod(x,y)
%绝对值 %取复数虚部 %取复数实部 %复数共轭
16/128 MALAB 7.X程序设计
第2章 MATLAB 矩阵及其运算
4. 取整函数 fix(x) 朝零方向取整 floor(x) 朝负无穷大方向取整 ceil(x) 朝正无穷大方向取整 round(x)四舍五入 mod(x,y) rem(x,y)取x/y的余数要求x,y 必须为相同大小的实矩阵或为标量。 eg: x=5.3 x=-5.3 -5.3 -5 0 5 5.3
matlab矩阵乘法

matlab矩阵乘法MATLAB(MatrixLaboratory)是一款常用的科学运算计算软件包,用它开发的应用程序可以用于数学、统计、优化、仿真等领域。
MATLAB 中的矩阵乘法是MATLAB的基本计算操作,是能够实现向量和矩阵的运算。
一、矩阵乘法的定义矩阵乘法是指两个同样大小的矩阵相乘,按照一定的计算公式,得到一个新的矩阵。
因为大多数数学问题都可以用矩阵表示,所以用矩阵乘法可以把复杂的运算简化成一步计算,这在大量数字计算中很有帮助。
矩阵乘法的计算公式如下:设A是m×n矩阵,B是n×p矩阵,则A×B=C是m×p矩阵,其中:$$C_{ij} = sum_{k=1}^{n}A_{ik}B_{kj}$$二、MATLAB的矩阵乘法MATLAB中的矩阵乘法主要提供了三种矩阵乘法指令,即“*”、“.*”、“times”。
1、*”和“.*”“*”是矩阵标准乘法运算符,是指矩阵相乘时,最常用的形式,其计算公式如上所述,但要求两个矩阵的列数一致。
而“.*”则是矩阵的点乘法,即每个元素分别相乘,而不是矩阵乘法,其计算公式为:$$C_{ij} = A_{ij} times B_{ij}$$2、“times”“times”是MATLAB中的特殊形式矩阵乘法。
它接受两个参数,一个是要求被乘数A是m×n矩阵,另一个要求乘数B是n×1向量,计算公式如下:$$C_{ij} = sum_{k=1}^{n}A_{ik}B_{k}$$三、MATLAB中矩阵乘法的应用在各类应用软件中,MATLAB的矩阵乘法有着广泛的应用,主要应用于数据处理、优化计算以及机器学习等领域。
1、数据处理采用矩阵乘法可以实现数据的简单处理,例如矩阵的转置与行列重排。
2、优化问题矩阵乘法可以用于求解复杂优化问题,比如最小二乘法拟合问题、最小角回归问题等,这些优化问题也可以通过矩阵乘法的形式进行解算,大大提高了运算的效率。
Matlab 矩阵的运算

(1) 矩阵加减运算 假定有两个矩阵A和B,则可以由A+B和 A-B实现矩阵的加减运算。 运算规则是:若A和B矩阵的维数相同, 则可以执行矩阵的加减运算,A和B矩阵的相 应元素相加减。如果A与B的维数不相同,则 MATLAB将给出错误信息,提示用户两个矩 阵的维数不匹配。 (2) 矩阵乘法 假定有两个矩阵A和B,若A为m×n矩阵, B为n×p矩阵,则C=A*B为m×p矩阵。
关系运算符的运算法则为: (1) 当两个比较量是标量时,直接比较两 数的大小。若关系成立,关系表达式结果为1, 否则为0。 (2) 当参与比较的量是两个维数相同的矩 阵时,比较是对两矩阵相同位置的元素按标 量关系运算规则逐个进行,并给出元素比较 结果。最终的关系运算的结果是一个维数与 原矩阵相同的矩阵,它的元素由0或1组成。
例3-3 先建立 5×5矩阵A,然后将A的第一 行元素乘以1,第二行乘以2,…,第五行乘 以5。 A=[17,0,1,0,15;23,5,7,14,16;4,0,13,0,22; 10,12,19,21,3;11,18,25,2,19]; D=diag(1:5); D*A %用D左乘A,对A的每行 乘以一个指定常数
3.3 字符串
在MATLAB中,字符串是用单撇号(‘)括 起来的字符序列。 MATLAB 将字符串当作一个行向量, 每个元素对应一个字符,其标识方法和数值 向量相同。也可以建立多行字符串矩阵。
字符串是以ASCII码形式存储的。abs和 double函数都可以用来获取字符串矩阵所对 应的ASCII码数值矩阵。 相反,char函数可以把ASCII码矩阵转换 为字符串矩阵。
3.2.4 方阵的行列式
把一个方阵看作一个行列式,并对其按 行列式的规则求值,这个值就称为矩阵所对 应的行列式的值。 在MATLAB中,求方阵A所对应的行列 式的值的函数是det(A)。
matlab矩阵乘法

matlab矩阵乘法众所周知,矩阵是数学、计算机科学等专业的基础知识之一。
但是由于我们学习矩阵的时间太短,导致很多同学都觉得矩阵比较难理解。
其实,矩阵不仅有它自己独特的魅力,更重要的是能帮助我们理解矩阵的性质。
在众多科学领域中,矩阵是使用最广泛的数据结构。
所以,我们应该利用好矩阵,让矩阵发挥它最大的价值。
那么, matlab有什么好的矩阵功能来辅助我们学习矩阵呢?下面,我们就来简单了解一下。
MATLAB矩阵乘法可分为两类:矩阵运算和矩阵变换。
矩阵运算通过运算符(+,-,*,/)完成,用以实现矩阵之间的加减乘除运算。
对于矩阵A,先按照A行变换到B列,再执行A列变换到B行。
矩阵变换则通过矩阵的某些特征进行矩阵之间的相乘或转置操作。
这种方法适合于一般矩阵的变换。
矩阵乘法通过矩阵的所有元素与矩阵相乘得到矩阵的乘积,然后将乘积输出到屏幕上。
MATLAB还提供了矩阵的幂、方根、倒数、迹等功能。
这些功能均可通过矩阵乘法完成。
矩阵运算与矩阵变换的区别如下:matlab的矩阵数组类似于数组,但数组只能一次性存储1维或2维的数据。
矩阵数组可以包含多维数据,即矩阵数组中的元素是由若干个矩阵元素组成的。
例如,假设有三个二维矩阵元素A, B和C,那么矩阵数组3维数组( A, B, C)中的第三个元素D就是由矩阵元素C和C组成。
matlab也提供了矩阵数组转矩阵数组的功能,例如矩阵数组A转矩阵数组B。
当用matlab进行矩阵运算或矩阵变换时,我们可以使用矩阵的运算符(+,-,*, /)进行运算或者矩阵的某些特征(如倒数,迹)进行矩阵之间的相乘或转置操作。
例如:matlab的矩阵乘法是对矩阵进行矩阵的运算,比如求两个矩阵的积,而矩阵变换则是对矩阵进行矩阵的变换,即矩阵的乘法。
而且矩阵运算中还包括求矩阵的逆矩阵。
对于一般矩阵来说,矩阵的运算或矩阵的变换效率高,但是对于复杂矩阵而言,运算或变换的速度就相对较慢,因此矩阵乘法是不适用于计算一般矩阵的,通常只用来对矩阵进行快速运算。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
matalb矩阵计算(MATLAB矩阵计算)matalb矩阵计算(MATLAB矩阵计算)4.1 array operations and matrix operationsFrom the appearance of the shape and structure of the data matrix, two-dimensional array and no difference in mathematics. However, as the embodiment of a matrix transformation or mapping operator matrix with mathematical rules, clear and strict. And array operation is defined by the software of MATLAB rules, its purpose is for data management, simple operation. The instruction form nature and perform calculations effectively. Therefore, when using MATLAB, in particular to a clear distinction between clear array operations and matrix operations. Table 4.1.1 lists the similarities and differences between the essence and connotation of two kinds of operation instruction.4.1.1 array operations and matrix operations, instruction forms and substantive meaningArray operationMatrix operationinstructionsMeaninginstructionsMeaningA.'Non conjugate transposeA'Conjugate transposeA=sAssign scalar s to each element of the array AS+BAdd scalar s to each element of the array B, respectivelyS-B, B-sThe difference between the scalar s and the elements of the array B S.*AScalar s is the product of the elements of the array A, respectively S*AThe product of the scalar s and the elements of the matrix A, respectivelyS./B, B.\sScalar s is separated by the elements of array B, respectivelyS*inv (B)Inverse multiplicative scalar B of matrix sA.^nThe N sub order of each element of the array AA^nWhen A is a square matrix, the n power of the matrix AA+BThe addition of an array corresponding elementA+Bmatrix additionA-BSubtracting elements of an arrayA-BMatrix subtractionA.*BMultiplication of an array corresponding elementA*BThe product of the same matrix NevilleA./BThe elements of A are excluded by the corresponding elements of B A/BA right, except BB.\AIt must be the sameB\AA left exceptB (usually different from right division)Exp (A)For the end to e respectively with A elements as index, exponentiationExpm (A)Matrix exponential function of ALog (A)The logarithm of the elements of ALogm (A)The matrix logarithmic function of ASqrt (A)The square root of the elements of the product of ASqrtm (A)A's square function of matricesFrom the above we can see that the array operations such as multiplication, addition, multiplication, transpose, add "points". Therefore, we should pay special attention to "multiply, divide, involution, trigonometric and exponential function", two operations are fundamentally different. In addition, in the implementation of the array and array operation when the array must be involved in computing Tongwei, the result is always with the original array array dimensions.4.2 basic operations of an arrayIn MATLAB, an array operation is a.MATLAB that uses the same calculation for multiple numbers to process arrays in a very intuitive way4.2.1 point transpose and conjugate transpose` - dot transpose. Non conjugate transpose, equivalent to conj (A') A=1:5;'b=a.'= bOneTwoThreeFourFive'c=b.'= C12345This shows that the two transpose of the row vector yields the original row vectorConjugate transpose. Transpose the vectors and conjugate each element:D=a+i*a= DColumns 1 through 31 + 1.0000i2 + 2.0000i3 + 3.0000iColumns 4 through 54 + 4.0000i5 + 5.0000iE=d'= e1 - 1.0000i2 - 2.0000i3 - 3.0000i4 - 4.0000i5 - 5.0000i4.2.2 scalar (scalar) and four operations of an arraySimple mathematical operations can be performed between scalar and array, such as addition, subtraction, multiplication, division, and mixing operations"G=[1 234"567891011 12]G=g-2= g-1 0123456789102*g-1= ans-3 -1 135791113151719Four operations between 4.2.3 arraysIn MATLAB, the array between the four operations, an array of participating in operation must have the same dimension, subtraction, multiplication, addition, operation is carried out according to the elements and elements forms. Among them, the array between the addition, subtraction and matrix addition, subtraction to the same operator, as: "+" "-". However, the array multiplication, division and matrix multiplication, division operation symbol is completely different, thereare differences, between the array multiplication and division operators: "*", "/" or ".".1. array by element add, minus"G=[1 234"567891011 12]"H=[1 111; 2222; 333; 3]"> g+h% added by element= ans23457891012131415> ans-h%, subtract by element= ans123456789 10 11 12> > > > > > > 2 g / h) 混合运算years.1 3 5 78 10 12 1415 17 19 212. 按元素乘> > > > > > > g * hyears.1 2 3 410 12 14 1627 30 33 363. 按元素除数组间的除法运算符有两个, 即左除 "/" 和右除 "." 它们之间的关系是.a /b = b.> > > > > > > g / hyears.1.00002.00003.00004.00002.50003.00004.1000 4.00003.0000 3.3333 3.66674.0000"h \ gyears.1.00002.00003.00004.00002.50003.00004.1000 4.00003.0000 3.3333 3.66674.0000幂运算.在matlab中, 数组的幂运算的运算为 "." 表示每一个元素进行幂运算. > > > > > > > (2% 数组g每个元素的平方.years.1 4 9 425, 36, 49, 6481% (144> > > > > > > g ^ (- 1)) 数组g的每个元素的倒数years.1.0000 0.5000 0.3333 0.25000.2000 0.1667 0.1429 0.12500.1111 0.1000 0.0909 0.0833> > > > > > > 2 g%, 以g的每个元素为指数对2进行乘方运算.years.2 4 8 1632, 64, 128, 256512 1024, 2048, 4096> > > > > > > "h% 以h的每个元素为指数对g中相应元素进行乘方运算.years.1 2 3 425, 36, 49, 64729 1000, 1728> > > > > > > (h - 1).years.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 6 7 881% (144- 数组的指数, 对数和开方运算在matlab中, 所谓数组的运算实质是是数组内部每个元素的运算, 因此, 数组的指数, 对数和开方运算与标量的运算规则完全是一样的, 运算符函数分别为: exp () log (), () must 等.> > a = [1, 3, 4, 5, 2, 6, 3, 2, 4].> > > > > > > c = exp (a)c =2.7183 20.0855 54.59827.3891 403.4288 148.413220.0855 7.3891 54.5982> > > > > > > > > > > >数组的对数, 开方运算与数组的指数运算, 其方式完全一样, 这里不详述.向量运算.对于一行或一列的矩阵, 为向量, matlab有专门的函数来进行向量点积, 叉积和混合积的运算.the 向量的点积运算在高等数学中, 我们知道, 两向量的点积指两个向量在其中一个向量方向上的投影的乘积, 通常用来定义向量的长度.在matlab中, 向量的点积用函数 "dot"来实现, 其调用格式如下.c = dot (a, b) - 返回向量a与b的点积, 结果存放于c中.c = dot (a, b, d) - 返回向量a与b在维数为dim的点积, 结果存放于c中.> > a = [4 2 5 3 1).> > b = (3 8 10 12 13].> > > > > > > c = (a, b).c =137> > > > > > > c = dot (a, b, (4)c =32 50 36 13 6a 向量的叉积运算在高等数学中, 我们知道, 两向量的叉积返回的是与两个向量组成的平面垂直的向量.在matlab中, 向量的点积用函数 cross 来实现, 其调用格式如下.c = cross (a, b) - 返回向量a与b的叉积, 即, 结果存放于c中.c = cross (a, b, d) - 返回向量a与b在维数为dim的叉积, 结果存放于c 中.> > a = [2, 5].> > b = [3, 10].> > > > > > > c = cross (a, b)c =0 - 5 4these 向量的混合运算> > > > > > > d = dot (a, cross (b, c))d =41上例表明, 首先进行的是向量b与c的叉积运算, 然后再把叉积运算的结果与向量a进行点积运算.4.4 矩阵的基本运算如果说matlab的最大特点是强大的矩阵运算功能, 此话毫不为过.事实上, matlab中所有的计算都是以矩阵为基本单元进行的.matlab对矩阵的运算功能最全面, 也是最为强大的.矩阵在形式上与构造方面是等同于前面所述的数组的, 当其数学意义却是完全不同的.矩阵的基本运算包括矩阵的四则运算, 矩阵与标时的运算, 矩阵的幂运算, 指数运算, 对数运算, 开方运算及以矩阵的逆运算, 行列式运算等.it 矩阵的四则运算矩阵的四则运算与前面介绍的数组的四则运算基本相同.但也有一些差别.1. 矩阵的加减The addition and subtraction of a matrix is exactly the same as the addition and subtraction of an array, which requires the exact size of the two matrix to be exactly the same"A=[1 2; 35; 2; 6]";"B=[2 4; 18; 9; 0]";C=a+b= C36413116Multiplication of 2. matricesFor the multiplication of matrices, from linear algebra, we know that the two matrices required to be multiplied have the same common dimension as:"A=[1 2; 35; 2; 6]";"B=[2 41; 89, 0]";C=a*b= C182214657352622A A matrix is a matrix order, will requireB matrix multiplication and must be an order, get the matrix order. That is, only when the first matrix (left column matrix) is equal to the number of second matrices (right matrix) the number of rows, the product of two matrices is meaning.Division of 3. matricesFor the division of a matrix, there are two arithmetic symbols, namely "left" except "symbol" and "right" except "sign" / "." the right division of the matrix is slower, and the "left" operation can avoid the influence of singular matrixFor the equation, if this equation is overdetermined equation, then use division can automatically find the solution of minimizing square. If the equation is Diophantine equation, is used to solve the division operator at least at most rank (A)(rank of matrix A) non zero elements, and the solution of this type of in the solution of a minimum norm."A=[21 3420; 57820; 211417; 3431; 38]";"B=[10 2030, 40]'";X=b\a= x0.7667, 1.1867, 0.8767The above equation is overdetermined. Note that the resulting matrix X is column vector,"A=[21 34205; 78202114; 173431; 38]";"B=[10 20, 30]'";X=b\a= x1.6286, 1.2571, 1.1071, 1.0500The equation above is an indeterminate equationFour operations between 4. matrices and scalarsThe four operations and the four operations of scalar matrixand array and scalar between identical, i.e. each element in the matrix and scalar add, subtract, multiply, with the exception of the four operations. That is, when a division operation is performed, the scalar can only do the dividend.Power operation of 5. matricesThe power operation of a matrix is different from the power operation of a scalar. Using the symbol ^, it is not a power operation for each element of the matrix, but is related to some decomposition of the matrix"B=[21 3420; 782021; 1734; 31]";C=b^2= C3433207417543555376626313536231220156. matrix index, logarithmic and square root operationThe index matrix calculation, logarithmic and square root operations and an array of the corresponding operations are different. It is not a single element in the matrix operations, but for the whole matrix. These operations function as follows:Expm, expm1, expm2, expm3 - exponential arithmetic functions;Logm - logarithmic function;Sqrtm - root operation function."A=[1 34; 265; 32; 4]";> c=expm (a)= C1.0e+004 *0.4668, 0.7694, 0.92000.7919, 1.3065, 1.56130.4807, 0.7919, 0.9475> c=logm (a)= C0.5002 + 2.4406i 0.5960 - 0.6800i 0.7881 - 1.2493i0.4148 + 0.4498i 1.4660 - 0.1253i 1.0108 - 0.2302i0.5780 - 1.6143i 0.4148 + 0.4498i 1.0783 + 0.8263i> c=sqrtm (a)= C0.6190 + 0.8121i 0.8128 - 0.2263i 1.1623 - 0.4157i0.3347 + 0.1497i 2.3022 - 0.0417i 1.1475 - 0.0766i1.0271 - 0.5372i 0.3347 + 0.1497i 1.6461 + 0.2750iTranspose, inverse operation and determinant operation of 7.matricesThe transpose operator of the matrix is', 'and the inverse uses the arithmetic function: inv (), and uses the function: det () to determine the size of the determinant of the matrix"A=[1 20; 25-1; 410; -1]";C=a'= C12425100-1 -1> b=inv (a)= b52 -2-2 -1 10 -2 1> d=det (a)= DOneSpecial operations of 4.5 matricesThe special operations of matrix include matrix eigenvalue operation, conditional number operation, singular value operation, norm operation,rank operation, orthogonalization operation, trace operation, pseudo inverse operation, etc. these operations can be conveniently given by MATLABEigenvalue operations of 4.5.1 matricesIn linear algebra, it is very complicated to compute the eigenvalues of matrices. In MATLAB, the matrix eigenvalue operations are computed only by the function eig () or eigs (). The format is as follows E=eig (X) - generates a column vector consisting of the eigenvalues of the matrix X;[V, D]=eig (X) - generates two matrices V and D, where V is a matrix consisting of the eigenvectors of the matrix X as the column vectors, and D is the diagonal matrix made up of the eigenvalues of the matrix X as the main diagonal elementsThe eigs () function uses the iterative method to solve the eigenvalues and eigenvectors of the matrixD=eigs (X) - generating a column vector consisting of eigenvalues of matrix.X, X must be square, preferably large sparse matrix;[V, D]=eigs (X) - generates two matrices V and D, where V is a matrix consisting of the eigenvectors of the matrix X as the column vectors, and D is the diagonal matrix made up of the eigenvalues of the matrix X as the main diagonal elements"A=[1 20; 25-1; 410; -1]";[b, c]=eig (a)= b-0.2440 -0.9107 0.4472-0.3333 0.3333 0-0.9107 -0.2440 0.8944= C3.7321000.267901Norm operations of 4.5.2 matrices (vectors)In order to reflect the characteristics of some matrix (vector), the norm of the concept of linear algebra, it is divided into 2- norm, 1- norm, infinite norm and Frobenius norm. In MATLAB, norm (or normest)with the function () matrix (vector) norm. The format is as follows.Norm (X) -- the 2- norm of the matrix (vector) X;Norm (X, 2) - ibid;Norm (X, 1) - compute the 1- norm of the matrix (vector) X;Norm (X, INF) -- the infinite norm of the matrix (vector) X;Norm (X,'fro') - compute the Frobenius norm of the matrix (vector) X;Normest (X) -- only the 2- norm of the matrix (vector) X is computed, and the estimate of the 2- norm is applied to the computation of norm (X), which is time-consuming"X=hilb (4)"= X1, 0.5000, 0.3333, 0.25000.5000, 0.3333, 0.2500, 0.20000.3333, 0.2500, 0.2000, 0.16670.2500, 0.2000, 0.1667, 0.1429"Norm (4)"= ansFour> norm (X)= ansOne point five Zero Zero two"Norm (X, 2)= ansOne point five Zero Zero two"Norm (X, 1)= ansTwo point zero eight three three> norm (X, INF)= ansTwo point zero eight three three> norm (X,'fro')= ansOne point five zero nine seven> normest (X)= ansOne point five Zero Zero twoConditional number operation of 4.5.3 matrixThe condition number of a matrix is a quantity of the "morbid" degree of the judgement matrix. The larger the condition number of the matrix A, the more morbid the A is, and conversely, the more "good" state of the A, for example, the Hilbert matrix is a well-known ill conditioned matrixCond (X) - the condition number of the 2- norm of the return matrix X;Cond (X, P) - returns the conditional number of the P- norm of the matrix X, where P is 1,2, inf or fro;Rcond (X) - the inverse value used to compute the condition numberof a matrix. When the matrix X is ill conditioned, rcond (X) is close to 0 and X is "good", and rcond (X) is close to 1.Condest (X) - calculates the estimate of the condition number of the 1- norm of the matrix X"M=magic (3)"= M816357492"H=hilb (4)"= H1, 0.5000, 0.3333, 0.25000.5000, 0.3333, 0.2500, 0.20000.3333, 0.2500, 0.2000, 0.16670.2500, 0.2000, 0.1667, 0.1429> c1=cond (M)= C1Four point three three zero one> c2=cond (M)= C2Four point three three zero one> c3=rcond (M)= C3Zero point one eight seven five> c4=condest (M)= C4Five point three three three three > h1=cond (H)= H11.5514e+004> h2=cond (H, INF)= H22.8375e+004> h3=rcond (H)= H33.5242e-005> h4=condest (H)= H42.8375e+004From the calculation, we can see that the Rubik's cube matrix is better, and the Hilbert matrix is ill conditionedRank of 4.5.4 matrixRank is one of the important concepts in linear algebra, usually by elementary determinant or matrix can be transformed into the column transform, row echelon matrix, the number of rows and the ladder matrix contains nonzero row is a constant, the determination of the non zero line number is the rank of matrix matrix. The rank function (rank) to calculate."T=rand (6)"= T0.9501, 0.4565, 0.9218, 0.4103, 0.1389, 0.01530.2311, 0.0185, 0.7382, 0.8936, 0.2028, 0.74680.6068, 0.8214, 0.1763, 0.0579, 0.1987, 0.44510.4860, 0.4447, 0.4057, 0.3529, 0.6038, 0.93180.8913 0.6154 0.9355 0.8132 0.2722 0.46600.7621 0.7919 0.9169 0.0099 0.1988 0.4186> r =秩(t)R =六由上计算可知,矩阵T为满秩矩阵。