/
Matrices An m  * n  matrix is a two-dimensional array of Matrices An m  * n  matrix is a two-dimensional array of

Matrices An m * n matrix is a two-dimensional array of - PowerPoint Presentation

freya
freya . @freya
Follow
65 views
Uploaded On 2023-10-27

Matrices An m * n matrix is a two-dimensional array of - PPT Presentation

numbers consisting of m rows and n columns Special cases are a column vector n 1 and a row vector m 1 Matrices are fundamental to Matlab and even if you are not intending to use ID: 1025214

returns matrix eye zeros matrix returns zeros eye array row vector main diagonal matrices column scalar size square separate

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Matrices An m * n matrix is a two-dime..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. Matrices

2. An m * n matrix is a two-dimensional array of numbers consisting of m rows and n columns. Special cases are a column vector (n = 1) and a row vector(m = 1). Matrices are fundamental to Matlab and even if you are not intending to use Matlab for linear algebra computations you need to become familiar with matrix generation and manipulation

3. MatricesA is an m x n matrix.A Matrix array is two-dimensional, having both multiple rows and multiple columns, similar to vector arrays:it begins with [, and end with ]spaces or commas are used to separate elements in a rowsemicolon or enter is used to separate rows.Example:>> f = [ 1 2 3; 4 5 6] f = 1 2 3 4 5 6the main diagonal

4. Matrices can be built explicitly using the square bracket notation.For example, a 3-by-3 matrix comprising the rst 9 primes can be set up with the command A = [2 3 5 7 11 13 17 19 23] The end of a row can be specified by a semicolon instead of a carriage return, so a more compact command with the same effect is “Semi-colons separate Rows” A = [2 3 5; 7 11 13; 17 19 23] Within a row, elements can be separated by spaces or by commas \Commas separate Columns" .

5. Matrix Addressing-- matrixname(row, column)-- colon may be used in place of a row or column reference to select the entire row or column.recall:f = 1 2 3 4 5 6h = 2 4 6 1 3 5Example:>> f(2,3)ans = 6>> h(:,1)ans = 2 1

6. Matrices (con’t…)TransposeB = A’Identity Matrixeye(n)  returns an n x n identity matrixeye(m,n)  returns an m x n matrix with ones on the main diagonal and zeros elsewhere.Addition and subtractionC = A + BC = A – BScalar MultiplicationB = A, where  is a scalar.Matrix MultiplicationC = A*BMatrix InverseB = inv(A), A must be a square matrix in this case.rank (A)  returns the rank of the matrix A.Matrix PowersB = A.^2  squares each element in the matrixC = A * A  computes A*A, and A must be a square matrix.Determinantdet (A), and A must be a square matrix.more commandsA, B, C are matrices, and m, n,  are scalars.

7. eyeIdentity matrixI = eye returns the scalar, 1.I = eye(n) returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere. I = eye(4)I = 4×4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1I = eye(n,m) returns an n-by-m matrix with ones on the main diagonal and zeros elsewhere.I = eye(2,3) 1 0 0 0 1 0

8. eyeIdentity matrixThe values of the vector in eye([2,3]) defines the size of the vector.For example, eye([2,3]) returns a 2-by-3 array with ones on the main diagonal and zeros elsewhere. sz = [3,1]; I = eye(sz)I = 3×1 1 0 0

9. onesCreate array of all onesSyntaxX = ones %returns the scalar 1X = ones(n) % returns an n*n matrix of onesX=ones([2*3]) Returns 2*3 array of ones

10. zerosCreate array of all zerosSyntaxX = zeros %returns the scalar 0X = zeros(n) % returns an n*n matrix of zerosX = zeros(sz) % returns an array of zeros where the size vector, sz, defines size (x)For exampleA = [1 4; 2 5; 3 6];sz = size(A);X = zeros(sz) X = 3×2 0 0 0 0 0 0