- Matlab-Matrix Tutorial
- Matlab-Matrix - Home
- Matlab-Matrix - Introduction
- Matlab-Matrix - Environment Setup
- Matlab-Matrix - Create Matrix
- Matlab-Matrix - Working with Matrices
- Matlab-Matrix - Multiplication
- Matlab-Matrix - Addition
- Matlab-Matrix - Subtraction
- Matlab-Matrix - Matrix Determinant
- Matlab-Matrix - Inverse
- Matlab-Matrix - Trace
- Matlab-Matrix - Rank
- Matlab-Matrix - Transpose
- Matlab-Matrix - Deletion Row & Coloumn
- Matlab-Matrix Useful Resources
- Matlab Matrix - Quick Guide
- Matlab Matrix - Useful Resources
- Matlab Matrix - Discussion
Matlab-矩阵 - 加法
要添加两个矩阵,两个操作数矩阵必须具有相同的行数和列数。
例子
这是一个例子
a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = a + b
输出
在 MATLAB 中执行时,结果如下 -
>> a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = a + b c = 8 7 9 6 5 14 12 15 10 >>
plus() 函数
您还可以使用 plus() 内置函数来添加两个矩阵,如下所示 -
例子
考虑以下使用 plus() 函数将两个矩阵相加的示例 -
a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = plus(a,b)
输出
MATLAB 中的执行如下所示 -
>> a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = plus(a,b) c = 8 7 9 6 5 14 12 15 10 >>