ppt

© All Rights Reserved

1 views

Matrices

ppt

© All Rights Reserved

- MTE-2
- Linear Algebra With Matlab
- NUMERICAL LINEAR ALGEBRA ITERATIVE METHODS.pdf
- Practical Machine Learning in R - Kyriakos Et Al. (2018)
- sym_storage_1.2.6-1.2.7_
- Aakash AIATS
- ex3
- Csec Math Jan2008
- The Answer
- Journal.pbio.0020439
- IIT Math Syll
- Spivey CMJ 2006
- Matricesdeterminants 110816105156 Phpapp02 (1)
- msc12
- Emt Lab Manuals
- Assignmt Mm Sem 1
- algebra lineal howar anton 2.3
- 10simpmat1A
- Tinkler Graph Theoretical Methods in Geography 1977
- 12 Mathematics Impq Matrices and Determinants 02

You are on page 1of 29

1

Entering a Matrix in MATLAB

2 -3 5�

�

A=� �

-1 4 6 �

�

MATLAB Format

>> A = [2 -3 5; -1 4 5]

A =

2 -3 5

-1 4 5

2

Entering a Row Vector in

MATLAB

x = [1 4 7]

MATLAB Format

>> x = [1 4 7]

x =

1 4 7

3

Entering a Column Vector in

MATLAB

1 ��

x = ��

4

��

��

7

��

MATLAB Format

>> x = [1; 4; 7]

x =

1

4

7

4

Alternate Way to Enter

a Column Vector

>> x = [1 4 7]'

x=

1

4

7

5

Matrix Addition and

Subtraction

Matrix addition and subtraction with

MATLAB are achieved in the same

manner as with scalars provided that

the matrices have the same size.

Typical expressions are shown below.

>> C=A+B

>> D=A-B

6

Error Messages

MATLAB has many error messages

that indicate problems with

operations. If the matrices have

different sizes, the message is

Matrix dimensions must agree.

7

Matrix Multiplication

Matrix multiplication with MATLAB is

achieved in the same manner as with

scalars provided that the number of

columns of the first matrix is equal to the

number of rows of the second matrix. A

typical expression is

>> E = A*B

8

Array Multiplication

There is another form of multiplication

of matrices in which it is desired to

multiply corresponding elements in a

fashion similar to that of addition and

subtraction. This operation arises

frequently with MATLAB, and we will

hereafter refer to the process as the

array product to distinguish it from

the standard matrix multiplication form.

9

Array Multiplication

Continuation

For the array product to be possible, the

two matrices must have the same size, as

was the case for addition and subtraction.

The resulting array product will have the

same size. If F represents the resulting

matrix, a given element of F, denoted by fij

is determined by the corresponding product

from the two matrices as

f ij = aij bij

10

MATLAB Array

Multiplication

To form an array product in MATLAB, a

period must be placed after the first

variable. The operation is commutative.

The following two operations produce

the same result.

>> F=A.*B

>> F=B.*A

11

MATLAB Array Multiplication

Continuation

which array multiplication is desired, the

periods should follow all but the last one

in the expression; e. g., A.*B.*C in the

case of three matrices. Alternately,

nesting can be used; e.g. (A.*B).*C for

the case of three matrices.

12

MATLAB Array Multiplication

Continuation

The array multiplication concept

arises in any operation in which the

command could be “confused” for a

standard matrix operation. For

example, suppose it is desired to form a

matrix B from a matrix A by raising

each element of A to the 3rd power,

The MATLAB command is

>> B = A.^3

13

Determinant of a Matrix

The determinant of a square

matrix in MATLAB is determined by

the simple command det(A). Thus,

if a is to represent the

determinant, we would type and

enter

>> a = det(A)

Note that a is a scalar (1 x 1

"matrix").

14

Inverse Matrix

MATLAB is determined by the simple

command inv(A). Thus, if B is to

represent the inverse of A , the

command would be

>> B = inv(A)

15

Simultaneous Equation

Solution

Ax = b

-1

x=A b

MATLAB Format:

>> x = inv(A)*b

AlternateMATLAB Format:

>> x = A\b

16

Example 1. Enter the matrices

below in MATLAB. They will be

used in the next several

examples. 2 1�

�

2 -3 5�

� � �

A=� � B=�

7 -4 �

-1 4 6 �

� �

3 1�

� �

>> A = [2 -3 5; -1 4 6];

17

Example 2. Determine the

transpose of B and denote it

as C.

>> C = B'

C =

2 7 3

1 -4 1

to a 2 x 3 matrix.

18

Example 3. Determine the

sum of A and C and denote it

as D.

>> D=A+C

D =

4 4 8

0 0 7

19

Example 4. Determine the

product of A and B with A

first.

>> A*B

ans =

-2 19

44 -11

20

Example 5. Determine the

product of B and A with B

first.

>> B*A

ans =

3 -2 16

18 -37 11

5 -5 21

21

Example 6. Determine the array

product of A and C and denote

it as E.

>> E = A.*C

E =

4 -21 15

-1 -16 6

22

Example 7. Enter the matrix A.

It will be used in several

examples.

�1 2 -1�

�

A=� �

-1 1 3�

�

�3 2 1 �

�

>> A = [1 2 -1; -1 1 3; 3 2 1]

A =

1 2 -1

-1 1 3

3 2 1

23

Example 7. Continuation.

Determine the determinant of A

and denote it as a.

>> a = det(A)

a =

20

24

Example 8. Determine the

inverse matrix of A and denote it

as Ainv.

>> Ainv = inv(A)

Ainv =

0.5000 0.2000 -0.1000

-0.2500 0.2000 0.1500

25

Example 9. Use MATLAB to solve the

simultaneous equations below.

x1 + 2 x2 - x3 = -8

- x1 + x2 + 3x3 = 7

3 x1 + 2 x2 + x3 = 4

26

Example 9. Continuation.

Assume that A is still in memory.

>> b = [-8; 7; 4]

b =

-8

7

4

27

Example 9. Continuation.

>> x = inv(A)*b

x =

2.0000

-3.0000

4.0000

28

Example 9. Continuation.

Alternately,

>> x = A\b

x =

2.0000

-3.0000

4.0000

29

- MTE-2Uploaded byMohit Chauhan
- Linear Algebra With MatlabUploaded byharish9
- NUMERICAL LINEAR ALGEBRA ITERATIVE METHODS.pdfUploaded byradoev
- Practical Machine Learning in R - Kyriakos Et Al. (2018)Uploaded byEdwin Alex Palomino Morales
- sym_storage_1.2.6-1.2.7_Uploaded byarsene
- Aakash AIATSUploaded byAdityanshu Behera
- ex3Uploaded byMatematicar Matematika
- Csec Math Jan2008Uploaded byJoshua Francis Pedro
- The AnswerUploaded bylimuz
- Journal.pbio.0020439Uploaded byomilani3482
- IIT Math SyllUploaded byRajesh Sarswat
- Spivey CMJ 2006Uploaded byพายุ ดอนแก้ว
- Matricesdeterminants 110816105156 Phpapp02 (1)Uploaded byKeith Tanaka Magaka
- msc12Uploaded bysaradha_ramachandran
- Emt Lab ManualsUploaded byJulio Cesar Domingos
- Assignmt Mm Sem 1Uploaded byYvince Loh
- algebra lineal howar anton 2.3Uploaded byIrvin Sandoval
- 10simpmat1AUploaded byPotnuru Vinay
- Tinkler Graph Theoretical Methods in Geography 1977Uploaded byJuan Garay
- 12 Mathematics Impq Matrices and Determinants 02Uploaded byAshok Pradhan
- Math 385685 October 09Uploaded byrrc8u
- LA Lectures 13-15 (updated).pdfUploaded bySarit Burman
- Syllabus_F13_220Uploaded byعلي كامل الاسدي
- Question 4 Scientific ComputingUploaded byPete Jacopo Belbo Caya
- Linear Control Systems_B. S. MankeUploaded byRahul Gupta
- MOCK MME Sem-II-13Uploaded byTeddy Jain
- 3 - Matrix FormulationUploaded bytrixia
- Solucións 1 Exame 2 Aval 2CUploaded byanamatesverin1321
- Introduction to MatLabUploaded bysamasimo5
- Jwb Hipper 2Uploaded byAditya R. Achito

- Radiological Anatomy With Barium MealUploaded byjmuhilan
- cblmUploaded bygina dunggon
- UNDP Human Development Report 2014 (Nigeria)Uploaded byRees Colayco
- PI ControlUploaded bySalim Khan
- Progress_Test_2.pdfUploaded byAngelly Leon
- Custodian 2018Uploaded byCHARYL DEE GINETE
- pr assignmentUploaded byArmin Amiri
- Jenis-jenis Genre (Teks)Uploaded byYusak Sedubun
- SB2.0Uploaded byMarvin Bryant Medina
- helenbenkerdiaryUploaded byapi-342750367
- B1 ThiamineUploaded byK Anjali
- HLK-RM04 User ManualUploaded byLosp Pacman
- RouboOneUploaded bykmarius7
- spssUploaded bydyar_stat87
- Writer Guidelines 11111Uploaded byBiljana Petrusevska
- (2008) Effect of spanwise ﬂexibility on ﬂapping wing propulsionUploaded byJoon Hyuk Park
- essay of choiceUploaded byapi-310101466
- Who/Fch/Cah/00.40 Distr.: General Original: EnglishUploaded byNimrod
- 2012 OQUIN STARBURST Lean Six Sigma for Healthcare Poster Apr 5 2012 AUploaded byshimaoka
- Specific GravityUploaded byNicole Cruz
- VirtuAlarm Announces False Alarm Reduction Platform for Security Alarm Monitoring CentersUploaded byPR.com
- kkjkjkjkUploaded byMiguel Nacpil
- Manage Personal Priorities.docxUploaded bySamina Akhtar
- myras 2016 resume 1Uploaded byapi-357388170
- North American Literature PoemsUploaded by여자마비
- BiotechValuationModelUploaded bysachinmatpal
- Rudraksha related postsUploaded byAkash Agarwal
- Homework PptUploaded byFransisca Kurnia Adiningsih
- Best Practice in Essbase Business Rule Writing-manuskriptUploaded bysen2nat
- persuasive essay graphic organizerUploaded byapi-400072597