100 likes | 248 Views
LESSON 3 MATRICES. Azalya Rahmatika Fathul Fithrah. JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM, BANDA ACEH April , 2013. Creating Matrices. Create a Row Vector. Create a Column Vector. Create a Column Vector same as above.
E N D
LESSON 3 MATRICES AzalyaRahmatika FathulFithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM, BANDA ACEH April, 2013
Creating Matrices Create a Row Vector Create a Column Vector Create a Column Vector same as above Create a matrix a which is a concatenation of x and y, provided they are compatible (same number of rows) Define a 3x3 matrix. Semicolons indicate end of a row A simpler syntax is available, which does not require to use the comma and semicolon characters. When creating a matrix, the blank space separates the columns while the new line separates the rows.
There are some handy utility functions to generate commonly used matrices, such as zero matrices, identity matrices, diagonal matrices, matrix containing randomly generated numbers etc. Creates a 5x8 matrix with all elements zero. Creates a 4x6 matrix with all elements 1 Creates a 3x3 identity matrix Creates a 3x3 diagonal matrix, with diagonal elements equal to 10. Create a matrix with 3 rows and 5 columns, the elements being random numbers between 0 and 1. Create a matrix with 3 rows and 5 columns, the elements being random real numbers between 0 and 10. Create a matrix with 3 rows and 5 columns, the elements being random real numbers between 0 and 10.
Simple Matrix Operations Transpose a and store it in b. Apostrophe (') is the transpose operator. Add a to b and store the result in c. aandb must be of the same size. Otherwise, Scilab will report an error. Subtract b from a and store the result in d. Multiply a with b and store the result in e. a and b must be compatible for matrix multiplication. Define a 3x3 matrix with name f. Invert matrix f and store the result in g. f must be square and positive definite. Scilab will display a warning if it is ill conditioned. The answer must be an identity matrix Determinant of f. Matrix of log of each element of a.
Element by element multiplication. Same as a * a Element by element square. Matrix addition and subtraction already being element-wise operations, element-wise addition and subtraction result in an error: Error
Size returns the number of rows and columns in y Number of elements in y. Element y(1) is the same as y(1, 1) Element y(2) is the same as y(2, 1). Elements are counted column-wise Element y(6) is the same as y(3, 2). Elements are counted column-wise
Generates a row of numbers from 1 to 5 at an increment of 1 Generates a column of numbers from 1 to 5 at an increment of 1 Creates a row vector with 5 elements. Same as [1, 2, 3, 4, 5] Creates a column vector with 5 elements. Same as [1; 2; 3; 4; 5] Creates a vector with 11 elements as follows [0, 0.5, 1.0, 1.5, ... 4.5, 5.0] range requires a start value, an increment and an end value, separated by colons (:). If only two values are given (separated by only one colon), they are taken to be the start and end values and the increment is assumed to be 1 (a:b is a short form for a:1:b, where a and b are scalars). The increment must be negative when the start value is greater than the end value.
Accessing the Elements of a Matrix There are several methods to access the elements of a matrix A: the whole matrix, with the A syntax, element by element with the A(i,j) syntax, a range of index values with the colon ":" operator. Figure. Explain about how to call element matrix Using A(I,i) syntax and A syntax.
Figure. Explain about how to call element matrix Using colon “:” oparator
Thank You for Your Attention!