1 / 10

13.3 Matrices and Matrix Arithmetic

13.3 Matrices and Matrix Arithmetic. A 11 A 12 … A 1n A= A 21 A 22 … A 2n : : : : : : A m1 A m2 … A mn . 13.3.1 Definition and Properties of Small Matrices. >>A=[1 2 3 4;5 6 7 8 ;9 10 11 12;13 14 15 16];

job
Télécharger la présentation

13.3 Matrices and Matrix Arithmetic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 13.3 Matrices and Matrix Arithmetic A11 A12 …A1n A= A21 A22 …A2n : : : : : : Am1 Am2 …Amn 13.3.1 Definition and Properties of Small Matrices >>A=[1 2 3 4;5 6 7 8 ;9 10 11 12;13 14 15 16]; and >>A=[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ] P.S. : Matrix rows are separated by a semicolon a mew line, and the elements within a row of a matrix may be separated by commas as well as a blank. The elements of a matrix are enclosed by brackets.

  2. Accessing Matrix Elements : • Ex2: >>V = [ 5 4 3 2 1 ]; >>V(2) ans = 4 >> • Ex1: >>A(1,2),A(2,3) ans = 2 ans = 7 >> • Size of a Matrix : >>size([1 2 3 4 5 ;6 7 8 9 10 ;11 12 13 14 15 ] ) ans= 3 5 >>

  3. Square Matrices : Equal Matrices : • If a matrix has the same numbers of rows as columns(i.e.,m=n),then we say that it is square. >> A = [ 1 2 3; 4 5 6 ]; >>B=A; B= 1 2 3 4 5 6 >> • Defining Matrices with Built-In MATLAB Functions • Empty Matrices : >> eye(3,4) ans = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 >> >> A=[ ];

  4. 13.3.3 Application of Mathematical Functions to Matrices >>x=[ 1 2 3 4 5; 6 7 8 9 10 ] x= 1 2 3 4 5 6 7 8 9 10 >> then the command >>sin(x) ans = 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.794 0.6570 0.9894 0.4121 -0.5440

  5. 13.3.4 Colon Notation >> -3 : 3 ans= -3 -2 -1 0 1 2 3 >> The default increment is by 1 but that can be changed. For example : >>x = [0.0:0.1:2.0]’ ; >>y = sin(x); >>[x y] The third command takes the x and y column vectors and places then in a 21-by-2 matrix table.

  6. 13.3.5 Submatrices >> A=[1:6;2:7;4:9]; generates a 3-by-3 matrix >>A(1:4,3) is the column vector consisting of the first four entries of the third column of A >>A(:,3) is the third column of A, and A(1:4;) is the first four rows of A. 13.3.6 Matrix Arithmetic

  7. Matrix Transpose

  8. Matrix Addition and Subtraction

  9. Dot Product Ex : • Matrix Multiplication

  10. Scalar Multiplication of Matrices

More Related