- 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-矩阵 - 迹
Trace 帮助您计算给定矩阵中对角线元素的总和。
例子
考虑给定的 3x3 矩阵。让我们找出对角线元素的总和,如下所示 -
a = [ 1 2 3; 2 3 4; 1 2 5]; test = trace(a)
输出
MATLAB 中的执行如下 -
>> a = [ 1 2 3; 2 3 4; 1 2 5] test = trace(a) a = 1 2 3 2 3 4 1 2 5 test = 9 >>