Some basic knowledge of matrices in MATLAB

How to get successive elements or combinations from a matrix

Taking A as an example,
Insert image description here
there are two methods
1: Arrange the elements of A in a vertical and then horizontal manner.
Insert image description here
2: Position the element according to the specific number of rows and columns it is in.
Insert image description here
Example
The first method
Insert image description here
The second method
Insert image description here
A([1 3],[1 3])
where the previous [1 3] refers to the first and third lines, and the latter [1 3] refers to the first Column one and column three. Then take the intersection.
Replacing Entries

Change elements at certain positions in a matrix

Example:
Change the element 21 in the first row and second column of A to 76
Insert image description here

The usage of ":"
can be used to represent the traversal of the entire row or column. Another
usage
Insert image description here

Insert image description here
Array Manipulation
Two matrix dot multiplication ".*"
Insert image description here
division Dot
Insert image description here
division "./"
corresponding position elements are still placed at the position after division.
Insert image description here
Calculation of matrices and real numbers
Multiplication
Insert image description here
Matrix dot multiplication ".^" constant
Insert image description here

Related definitions of matrix

max(A): Find the maximum value of each column of the matrix.
max(max(A)): The maximum value of the entire matrix.
Insert image description here
min (minimum) and sum (summation) are used in the same way.
Sort sort
Insert image description here
sortrows(), according to the size of the first column, sort the entire row
Insert image description here
find
Insert image description here

Guess you like

Origin blog.csdn.net/Luohuasheng_/article/details/129676789