- 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 = -6 -3 -3 2 5 -2 2 1 8 >>
minus() 函数
您还可以使用 minus() 内置函数来减去两个矩阵。
例子
考虑以下使用 minus() 函数进行两个矩阵相减的示例 -
a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = minus(a , b)
输出
您将得到以下结果 -
>> a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c = minus(a , b) c = -6 -3 -3 2 5 -2 2 1 8 >>