lesson 3 matrices azalya rahmatika fathul fithrah jurusan matematika fakultas matematika dan ilmu...
TRANSCRIPT
![Page 1: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/1.jpg)
LESSON 3
MATRICES
Azalya RahmatikaFathul Fithrah
JURUSAN MATEMATIKAFAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM
UNIVERSITAS SYIAH KUALADARUSSALAM, BANDA ACEH
April, 2013
![Page 2: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/2.jpg)
Creating Matrices
Create a Row Vector
Create a Column Vector
Create a Column Vector same as above
Create a matrix a which is aconcatenation of x and y, provided theyare compatible (same number of rows)
Define a 3x3 matrix. Semicolonsindicate end of a row
A simpler syntax is available, which does not require to use the comma and semicoloncharacters. When creating a matrix, the blank space separates the columns while the new line separates the rows.
![Page 3: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/3.jpg)
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 diagonalelements equal to 10.
Create a matrix with 3 rows and 5 columns,the elements being random numbersbetween 0 and 1.
Create a matrix with 3 rows and 5 columns,the elements being random real numbersbetween 0 and 10.
Create a matrix with 3 rows and 5 columns,the elements being random real numbersbetween 0 and 10.
![Page 4: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/4.jpg)
Simple Matrix OperationsTranspose a and store it in b. Apostrophe (') is the transpose operator.
Add a to b and store the result in c. aand b 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.
![Page 5: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/5.jpg)
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
![Page 6: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/6.jpg)
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
![Page 7: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/7.jpg)
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.
![Page 8: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/8.jpg)
Accessing the Elements of a Matrix
1. the whole matrix, with the A syntax,2. element by element with the A(i,j) syntax,3. a range of index values with the colon ":" operator.
There are several methods to access the elements of a matrix A:
Figure. Explain about how to call element matrix Using A(I,i) syntax and A syntax.
![Page 9: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/9.jpg)
Figure. Explain about how to call element matrix Using colon “:” oparator
![Page 10: LESSON 3 MATRICES Azalya Rahmatika Fathul Fithrah JURUSAN MATEMATIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM UNIVERSITAS SYIAH KUALA DARUSSALAM,](https://reader036.vdocuments.site/reader036/viewer/2022082613/5697bfe31a28abf838cb4ece/html5/thumbnails/10.jpg)
Thank You
for Your Attention!