MATLAB matrix basics --week 01

A special matrix

. 1, zeros ()
①y = zeros (m): create elements of the m × m transmission matrix are all 0 to y.
②y = zeros (m, n) : create m × n transfer matrix elements are all 0 to y.
③y = zeros (size (x) ): x the same size and create a full matrix element 0 is transmitted to y.
2, ones ()
and zeros () uses the same function, but all the elements being one.
. 3, Eye ()
Y = Eye (m) or the eye (m, m): 1 to create a diagonal, the other of m × m matrix 0
(ps: if eye (3,4), the matrix was :
. 1 0 0 0
0. 1 0 0
0 0 0. 1)
. 4, RAND ()
identical to zeros () function usage, but random floating element between 0-1.
. 5, randn ()
Y = A + sqrt (B) * randn (m): and rand () consistent usage, but a, b are respectively determined mean and covariance matrix.
6, cube matrix
y = magic (m)
Size: m × m
features: a matrix each row, each column, the elements of the diagonal and both primary and secondary × m (m ^ 2 +. 1) / 2
. 7, Vandermonde matrix
y = vander (1: n)
size: n × n
features: The last one is a whole, as the penultimate (1,2,3,4,5, ... n), as the inverse of the third (1 ^ 2 2. 3 ^ 2 ^ 2. 4 2 ... n- 2), as the fourth to last ...
ps: If vander (m: n), the bottom right part of the matrix taken.
8, Hilbert matrix
y = hilb (n)
Size: n × n
features: each element. 1 = Yij / (I-J +. 1)
. 9, matrix associated polynomials
first polynomial in powers of large items sorting small, nonzero coefficients into the matrix as input x.
y = compan (x): adjoint matrix generating polynomial.
10, Pascal matrix
y = pascal (m)
Size: m × m
features: a matrix arrangement as Pascal triangle, the size of each element on the element = element + Left.

Second, the matrix transformation

1, the diagonal elements extracted
diag (x, k)
the number of column vectors ①x greater than 1
k-th diagonal element of the matrix to extract the x, k 0 is the default, which is the main diagonal; the main diagonal to 0, then left down a k-1, the upper right shift a k + 1.
②x number of column vectors is equal to 1
to create the matrix elements are all 0, and placed on a column vector of the k-th diagonal.
2, the row vectors of the matrix elements of the vector are multiplied with
X = diag (. 1: 3);
; Y = ones (3)
then X Y ie
. 1. 1. 1
2 2 2
3 3 3
3 extracted, the diagonal matrix
①triu (x, k)
to extract the k-th diagonal matrix of the diagonal matrix x.
②tril (x, k)
diagonal matrix at the k-th diagonal matrix x of extraction.
4, the transpose matrix
Y = x. '
. 5, the rotation matrix
y = rot90 (x, k)
will be rotated counterclockwise matrix x [deg.] 90
K.
6, the matrix inversion
①fliplr (x)
about x matrix inversion
②flipud (x)
matrix x upside down
7, the inverse matrix
y = inv (x)

Third, the matrix value

1, the value of determinant: DET (X)
2, rank of the matrix: Rank (X)
. 3, the matrix trace: trace (x)
a vector norm:
Vector 1- norm: vector sum of absolute values of elements.
norm (x, 1)
vector 2-norm: root sum square of vector elements.
norm (x, 2), or norm (x)
a vector norm ∞-: the maximum of the absolute value of the vector elements.
norm (x, inf)
matrix norm
matrix 1- norm: maximum value of the absolute values of the column vector
norm (x, 1)
matrix 2-norm: the square root of the largest eigenvalue of the matrix
norm (x, 2), or norm (x)
matrix ∞- norm: maximum value among all absolute values of row elements and the
norm (x, inf)
condition of the matrix
is defined: norm condition number of a matrix x = x × x norm inverse matrix
properties: condition number closer to 1, the better the performance of the matrix.
cond (X,. 1)
cond (X, 2) or cond (X)
cond (X, INF)

Fourth, the matrix eigenvalues, eigenvectors

X = eig (A) X is a column vector of characteristic values thereof.
[D, X] column vector = eig (A) D of the feature vector, the main diagonal elements of X is the feature value.
Meaning: if A1 X1 = K1 X1, A2 x2 = K2 x2, can explore the eigenvalue A1 = Y1 X1 = K1 X1 and A2 = Y2 x2 = K2 relationship of x2.

Released six original articles · won praise 0 · Views 70

Guess you like

Origin blog.csdn.net/qq_44851357/article/details/105050358