{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab lesson1

# Matlab lesson1 - Lesson 1 Matrices and Vectors When you...

This preview shows pages 1–3. Sign up to view the full content.

Lesson 1: Matrices and Vectors When you think of arithmetic, you probably think of adding, subtracting, multiplying and di- viding numbers . However, basic arithmetic in Matlab is concerned with matrices . In this lesson, we recall what matrices are and what it means to perform various arithmetic operations with them. This will lay the groundwork for introducing Matlab in the next lesson. General Terminology A matrix is a rectangular array of numbers. It is usually written with brackets enclosing the numbers on either side. The following are all examples of matrices. a) A = 1 4 1 1 1 0 6 5 b) B = 2 1 0 3 5 4 0 3 7 c) C = 3 . 2 2 . 5 4 . 0 10 . 7 5 . 4 d) D = 0 1 2 e) E = 17 The number of rows and columns is called the dimension of the matrix. For instance, the matrix A above has 2 rows and 4 columns and is referred to as a 2 × 4 (read, “two by four”) matrix. The matrix B is 3 × 3, C is 1 × 5, D is 3 × 1, and E is 1 × 1. Notice that the number of rows is always stated first followed by the number of columns. Thus, D is a 3 × 1 matrix and not a 1 × 3 matrix. If a matrix has the same number of rows as columns then it is called a square matrix . The matrices B and E above are both square matrices. If a matrix has only one row or only one column then it can also be called a vector . More specifically, a matrix that has only one row is called a row vector and a matrix with only one column is called a column vector . For instance, C , D , and E are all vectors; C is a row vector, D is a column vector, and E is both a row vector and a column vector. Notice that a 1 × 1 matrix such as E above is simply a number. It can be written without brackets surrounding it. It is both a row vector and a column vector, but is most commonly referred to as a scalar . The rows of a matrix are numbered from top to bottom and the columns are numbered from left to right. For example, the first row of A is 1 4 1 1 and the second column is 4 0 . The numbers in a matrix are called entries . They can be identified by the row and column that they are in. For example, the entry in the second row and first column of A is -1 and the entry in the second row and third column of B is 4. If M is a matrix, then M ij refers to the entry in its i ’th row and j ’th column. For example A 21 = 1 and B 23 = 4. Notice that, just as the dimension of a matrix is the number of rows followed by the number of columns, an entry in a matrix is specified by stating first its row number and then its column number. Thus, A 21 = 1 but A 12 = 4. Two matrices are equal if and only if they have the same dimension and their corresponding entries are equal to each other. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 The transpose of a matrix M is the matrix that is obtained when the rows of M are turned into columns (and vice versa). The transpose of M is denoted M t . For instance, consider the matrix A above. To form A t we take the first row of A 1 4 1 1 and write it as a column, 1 4 1 1 .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Matlab lesson1 - Lesson 1 Matrices and Vectors When you...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online