Introduction to Matlab

Source: Internet
Author: User
Tags arithmetic scalar split
Common methods of mathematical modeling:Introduction to the differential equation--a general evaluation of statistical graphs and network interpolation and fitting data--numerical analysis and optimization method of regression analysis matlab Basic Representation method

1.MATLAB assignment Statement Two forms: variable = expression; An expression;

An expression is a formula that uses an operator to concatenate an operand, and the result is a matrix.
Attention:
(1) The second assignment is to assign the permanent variable ans.
(2) If you add a semicolon at the end of the statement, Matlab simply performs the assignment and no longer displays the result of the operation.
(3) In a statement, if the expression is too complex, a line can not be written, you may add three small black dots (...). ) as the endurance character.

2. Variable naming rules: Variable names are case sensitive. The first character of a variable must be an English letter and cannot exceed 31 characters. Variable names can contain characters, numbers, but not whitespace, punctuation.

3.MATLAB-expression

an arithmetic expression :
The key is /(right apart), (left), and for matrices, left and right divide represent two different divisor matrices and dividend matrix relationships.

Relational Expressions :
The key is not equal to ~=

Logical Expressions
& (with), | (or) and ~ (non) matrix representations

The basic unit of MATLAB's array preservation and transfer is not scalar , but array ; matlab arithmetic, relational, logical operation of the basic operational single source is not scalar, is an array.

Matrix type: one-dimensional, two-dimensional, multidimensional. Matrix Creation

Direct Input Method:
such as a = [1,2,3;4,5,6;7,8,9]. This is a matrix of 3 rows and 3 columns.

Colon expression method:
Colons can be used to produce vectors or to split matrices.
The General format is:
E1:e2:e3 where E1 is the initial value, E2 is the step, and E3 is the terminating value. That is, a colon expression can produce a line vector that starts from E1 to E3 and ends with a step e2.

Using the function linspace:
The general format is x = Linspace (x1, x2, N)
The function generates a row vector of n elements, X1 to its first element, X2 to its last element, and the interval between elements between X1,X2 (X2-X1)/(n-1).

Creation of column vectors
1. Using the square brackets "[]" operator, use the semicolon ":" to split the line.
2. Create the line vector first and then transpose.

Creation of Two-dimensional arrays
1. Using the "[]" operator
2. Function Method:
The function ones (generates all 1 matrices),zeros (generates all 0 matrices).

A two-dimensional array is arranged in columns from top to bottom , requiring the total number of array elements to be the same. the addressing and searching of array elements

1. Addressing the array element
"Full subscript" identification: Each dimension corresponds to a subscript.
such as a (2,3) represents the element of the "2nd row 3rd column" of the two-dimensional array A. For a one-dimensional array, you can use a subscript.

"Single subscript" Identification: Use a subscript to indicate the position of the element in the array.
For a two-dimensional array, it is envisaged that all the columns of the two-dimensional array, in order of the first and last phase into a "one-dimensional array." string

a sequence of characters enclosed in a single apostrophe is called a string. MATLAB treats a string as a line vector, with each element corresponding to one character. MATLAB Operations Note:

1./(right except), \ (left except) the difference:
The operation of a\b and b/a can be realized by setting A non-singular matrix.
a\b corresponds to the inverse left multiplier b,inv (a) *b of A;
b/a corresponds to the inverse right multiplication of a b,b*inv (a);
While the scalar left and right divide, the two are the same.

2. Point arithmetic:. * (Point multiplication)./(point right). \ (point left)
Two matrices If a point operation is performed, the corresponding element in the matrix is associated with the operation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.