In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In fact, in terms of modeling alone, most of the following functions are not needed, but these are the basics.
The first point: the distinction between array and matrix concepts
Array: like other programming languages, it is defined as a collection of elements of the same data type.
Matrix: in mathematics, a matrix (Matrix) is a set of complex or real numbers arranged in a rectangular array
But what you need to know is that what is often used in matlab is a two-dimensional matrix.
Then learn about the principles of several commonly used punctuation marks.
Comma: used to separate elements in an array
Semicolon: used to separate rows in a matrix
Square brackets: define the beginning and end of an array.
Row array: for example, a = [1, 2, 2, 3, 8, 1]
Array: B = [1 to 2, 3 to 8, 1 to 1]
Matrix: a = [2, 4, 4, 1, 1, 8, 2, 4, 4, 4, 4, 4, 4, 4, and 6]
Second, there are many ways to generate matrices.
As far as I know, there are about two kinds.
1. First establish the empty matrix a = []
Then click an in the workspace to enter the array editor and edit it
2, create an array with a function
(1): fixed step size generation method: x=a:t:b (t step size, omitted is 1)
> > xportable 1, 2, 2, 19
X =
13 5 7 9 11 13 15 17 19
(2): fixed number linear sampling method: x=linspace (a ~ ~ b ~ ~ n)
AQuery b is the first and last element of the array
N is the total number of points sampled.
> > x=linspace (1pr 32pr 13)
X =
Columns 1 to 9
1.0000 3.5833 6.1667 8.7500 11.3333 13.9167 16.5000 19.0833 21.6667
10 to 13 columns
24.2500 26.8333 29.4167 32.0000
3, some basic functions of the array
Zeros (m): M-order all-zero policy
Zeros (m _ 4N): M _ nth order all-zero policy
Eye (m): M order unit matrix
Matrix operation:
Left divided by the-1 power of\ AX=B;X=A times B.
Right division / XA=B;X=B times A to the power of-1
In the operation of matrix and constant, the constant can only be used as a divisor.
There is also a corresponding method for finding the inverse operation of a matrix (AB=BA=E (unit matrix)).
Invertible operation by function inv
> > A = [1 69 10 4 27 10 8 5 3]
A =
1 6 9
4 2 7
8 5 3
> > B=eye (3) / A
B =
-0.1070 0.0996 0.0886
0.1624-0.2546 0.1070
0.0148 0.1587-0.0812
> > inv (A)
Ans =
-0.1070 0.0996 0.0886
0.1624-0.2546 0.1070
0.0148 0.1587-0.0812
The determinant of matrix can be obtained by det function.
> a=magic (3)
A =
8 1 6
3 5 7
4 9 2
> > det (a)
Ans =
-360
The power operation of a matrix can be communicated.
The exponential function expm1 expm2 expm3 expm can easily complete the operation of matrix.
Matrix index is a matrix function of square matrix, which is similar to exponential function. The matrix index gives the relationship between the matrix lie algebra and the corresponding lie group.
Let X be a real or complex matrix of n × n. The index of X, with
Or exp (X), which is an n × n matrix given by the following power series:
The above series are always convergent, so the index of X is well defined. Note that if X is a 1 × 1 matrix, then the matrix index of X is a 1 × 1 matrix consisting of the exponents of the elements of X.
Expm common matrix exponential function
Calculation of Matrix Index by expm1 Pade method
Calculation of Matrix Index by expm2 Taylor method
Calculation of Matrix Index by expm3 Eigenvalue decomposition method
As long as you have an impression, it doesn't matter if you don't remember it. In fact, you generally don't need it.
Logarithmic operation of matrix (logm)
The square operation sqrtm of matrix
/ / the actual application of logarithm, exponent and square operation is not great.
Magic means that the sum of rows and columns, including major diagonals and secondary diagonals, is a worthwhile function.
Third, the basic function operation of matrix
The eigenvalues and Eigenvectors can be obtained by [xQuery y] = eig (A).
Expand:
/ *
In MATLAB, the function for calculating the eigenvalues and Eigenvectors of matrix An is eig (A), and there are five commonly used call formats:
E=eig (A): find all the eigenvalues of matrix A to form the vector E.
[Vmaine D] = eig (A): find all the eigenvalues of matrix A, form a diagonal matrix D, and find the eigenvector of A to form the column vector of V.
The second scheme is similar to the second format, but in the second scheme, the eigenvalues and Eigenvectors of the matrix An are obtained after the similarity transformation of A, while the eigenvalues and Eigenvectors of the matrix An are directly obtained in the format 3.
E=eig (A _ Magi B): the N generalized eigenvalues of N × N order square matrices An and B are returned by eig (A _ Magne B) to form the vector E.
The N × N order diagonal matrix D is formed by returning N generalized eigenvalues of square matrices An and B from eig (AMagne B). The N elements on the diagonal line of D are corresponding generalized eigenvalues. At the same time, the corresponding eigenvectors are returned to form N × N order full rank matrix, which satisfies AV=BVD.
Generalized eigenvalue
If the eigenvalue is extended to the complex field, a generalized eigenvalue has the following form: a v = λ B v
Where An and B are matrices. The generalized eigenvalue (the second meaning) λ can be obtained by solving the equation (A-λ B) v = 0 to obtain the set of matrices in the form of A-λ B det (A-λ B) = 0 (where det is the determinant). The complex term in the eigenvalue is called a "pencil".
If B is reversible, then the original relation can be written.
That is, the standard eigenvalue problem. When B is a non-invertible matrix (can not be inverted), the generalized eigenvalue problem should be solved by its original expression.
, /
Singular value function
Svd svds
Norm function
Norm (XBI P)
Prun1, 1 norm.
Pascal 2,2 norm
P=inf infinite norm
P=fro F norm
Rank function:
Rank to find rank
Trace function
The sum of all diagonal elements on a matrix is the trace of the matrix.
Trace
Orthogonal space function
The orthogonal basis of matrix can be obtained by using orth.
Conditional number function
Cond calculates the value of the condition number of a matrix
Condest calculates the estimate of the norm condition number of 1 of a matrix
Rcond calculates the reciprocal of the condition number of a matrix
Pseudo inverse function
When solving ill-posed problems, pinv avoids producing pseudo-solutions.
General function operation
Funm (A < title >)
to be continued
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.