Define the plural. For example:
X = 3 + 4I
Defines a matrix, similar:
A = [1 2 3; 4 5 6; 7 8 9]
Use SHIFT + F1 to view available functions, or directly click the FX button, for example:
Use rand to obtain a random number (within 0-1)
For example
Rand (3, 3)
Generate a Random Number Matrix with three rows and three columns;
To generate a Random Number Matrix with equal columns, you can use the rand (n) function, similar:
Rand (5 );
A Random Number Matrix of 5x5 is generated;
Use size to get the variable size, for example:
T = [1 2 3 4 5];
Size (t );
The result is 1 5, which is a row of 5 columns;
If
T = [1 2 3; 4 5 6; 7 8 9];
Size (t );
The result is three rows and three columns;
Matrix transpose, similar:
A = [1 2 3; 4 5 6; 7 8 9];
B = ';
It is to add a single quotation mark after;
You can use * to perform matrix multiplication directly. However, you must comply with the rules before Multiplication can be performed;
Otherwise, an error occurs, similar:
A = [1 2 3; 4 5 6; 7 8 9]
B = [1 2; 3 4]
Then a * B will report the following error:"
??? Error Using ==> mtimes
Inner matrix dimensions must agree.
"
. Operation, similar
A. * B
It is to multiply the elements corresponding to a and B. Likewise, it can be used in the/(Division) method, but Division is divided into the left and right vertices because of the difference of "/" and;
Similar;
A = [1 2; 3 4]
B ='
C = A./B
Output:
C =
1.0000 0.6667
1.5000 1.0000
However, when a. \ B is used, the output is:
C =
1.0000 1.5000
0.6667 1.0000
Use inv (n) to obtain the inverse matrix of the matrix, similar
A = [1 2; 3 4]
Inv ()
The output is:
Ans =
-2.0000 1.0000
1.5000-0.5000
You can use the matrix or array name a (m, n) to obtain the value of n columns in the m column of the Matrix, similar
A = [1 2 3; 4 5 6; 7 8 9]
A (2, 3)
Output:
Ans = 6
The following similar syntax can be used to output a specific area of the matrix:
A (1:3, 2: end)
Output
Matrix Values from 1-3 rows and 2-end Columns
Use
A (, :) indicates that all values in rows 1-3 are output, which replaces all columns. Similarly, a (:, 2: End) Outputs all columns whose ends are 2;
You can assign values to the above expressions, because their side effect is not the output value but the value in the matrix;
Therefore
A (:, 2: End) = 0
And then output A as follows:
A =
1 0 0 0
4 0 0 0
7 0 0 0
3 0 0 0
Use surf to create a 3D colored surface map (a 3D surface map) (I don't know what it is)
According to Baidu zhishang's statement:
Y = [];
W = y' * Y;
Surf (w );
The image is shown as follows:
MATLAB built-in Tutorial Study Notes 2