[] Matrix operation Matlab explain

A. Summation matrix

For example, a matrix A = [1,2,3; 2,3,4; 3,4,5], the following matrix calculation:

1. summing the elements of each column matrix:

ans = sum(A) = 6 9 12

2. The matrix elements of each row summation:
 

ans = sum(A,2) = 6;9;12

3. The sum of all the elements:

ans = sum(sum(A)) = 27 
或者
ans = sum(sum(A),2) = 27

II. Acquisition matrix dimensions

For example, find the number of rows and columns of the matrix M, M is the number of rows, N being the number of columns, the calculation is as follows:

[M,N]=size(H);


III. Matrix Multiplication

1. multiplication, matrix multiplication by dimension:

[m][n]*[n][m]=[m][m]

2. The dot matrix is ​​multiplied by the corresponding element position:

[m][n]*[m][n]=[m][n]

 

Published 218 original articles · won praise 891 · views 260 000 +

Guess you like

Origin blog.csdn.net/Robot_Starscream/article/details/105352691