You are on page 1of 53

Matrix Algebra

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Applied Force

Chapter 9

F = 200 lbf

20 feet

100

200
300
400
500

100

200

300

400

= 600

500

Pivot Point

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and
Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

In this chapter well learn


how to

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

perform the basic operations of


matrix algebra
solve simultaneous equations
using MATLAB matrix operations
use some of MATLABs special
matrices

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

The difference between an


array and a matrix

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Most engineers use the two terms


interchangeably
The only time you need to be
concerned about the difference is
when you perform matrix algebra
calculations

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Arrays

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Arrays can contain numeric


information, but they can also
contain character data, symbolic
data etc.

100

200
300
400
500

Technically an array is an orderly


grouping of information

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Matrix

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

The technical definition of a matrix is a


two-dimensional numeric array used in
linear algebra
Not even all numeric arrays can
precisely be called matrices - only
those upon which you intend to
perform linear transformations meet
the strict definition of a matrix.
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Matrix Algebra

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

used extensively in engineering


applications
Matrix algebra is different from the
array calculations we have
performed thus far

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Array Operators

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

A.* B
multiplies each element in
array A times the
corresponding
element in
array B
A./B
divides each element in
array A by the corresponding
element in array B
A.^B
raises each element in array
A to the power in the
corresponding element of array B

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Operators used in Matrix


Mathematics

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Transpose
Multiplication
Division
Exponentiation
Left Division

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Some Matrix Algebra


functions

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200

Dot products
Cross products
Inverse
Determinants

300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Transpose

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

AT

100

200
300
400
500

In mathematics texts you will


often see the transpose indicated
with superscript T

100

200

300

400

500

The MATLAB syntax for the


transpose is
A'
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

The transpose switches the


rows and columns

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

1
4

100

2
5
8

3
6

10 11 12

200
300

1 4 7 10
AT 2 5 8 11
3 6 9 12

400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Using the transpose with


complex numbers

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

When used with complex


numbers, the transpose
operator returns the complex
conjugate

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Dot Products

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

The dot product is sometimes


called the scalar product
the sum of the results when you
multiply two vectors together,
element by element.

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1

* *

||

||

-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

||
+

100

Equivalent
statements

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Example 9.1
Calculating the Center of Gravity

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Finding the center of gravity of a


structure is important in a number
of engineering applications
The location of the center of
gravity can be calculated by
dividing the system up into small
components.
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

xW x1W1 x2W2 x3W3 etc...


yW y1W1 y2W2 y3W3 etc...

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

zW z1W1 z2W2 z3W3 etc...


In a rectangular coordinate system
x , y , and z are the coordinates of the center of gravity

100

200
300
400
500

100

200

300

400

500

W is the total mass of the system


x1, x2, and x3 etc are the x coordinates of each system
component

y1, y2, and y3 etc are the y coordinates of each system


component

z1, z2, and z3 etc are the z coordinates of each system


component and

W1, W2, and W3 etc are the weights of each system


component

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

In this example

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

Well find the center of gravity of a


small collection of the
components used in a complex
space vehicle

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Vehicle Component
Locations and Mass

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Item

x, meters y, meters

z meters

Mass

Bolt

0.1

3.50 gram

screw

1.50 gram

nut

1.5

0.2

0.5

0.79 gram

bracket

1.75 gram

100

200
300
400
500

100

200

300

400

500

Formulate the problem using a dot product

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Input and Output

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Location of each component in an


x-y-z coordinate system in meters
Mass of each component, in grams

100

200

Output

300
400
500

Input

100

200

300

400

500

Location of the center of gravity

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Hand Example
Find the x coordinate of the center
of gravity

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

300
400

100

200

300

400

500

x, meters

Mass,
gram

x * m, gram
meters

Bolt

0.1

x 3.50

= 0.35

screw

x 1.50

= 1.50

1.5

x 0.79

= 1.1850

x 1.75

= 3.5

nut

200

500

Item

bracket
sum

7.54

6.535

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

We know that

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

The x coordinate is equal to


3

x
100

200

xm
i 1

mTotal

xm
i 1
3

This is a dot
product

m
i 1

i1

300
400
500

100

200

300

400

500

So
x =6.535/7.54 = 0.8667 meters
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

We could use a plot to


evaluate our results

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3

Center of Gravity

-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

z-axis

100

Center of Gravity

2
1

200
300

0
2

400
500

This plot
was created
using the
interactive
plotting
tools

100

200

300

400

500

1
y-axis

1
0

x-axis

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Matrix Multiplication

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Similar to a dot product

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Matrix multiplication results in an


array where each element is a dot
product.
In general, the results are found
by taking the dot product of each
row in matrix A with each column
in Matrix B
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Ci , j Ai ,k Bk , j
k 1

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Because matrix multiplication is a


series of dot products

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

the number of columns in matrix A


must equal the number of rows in
matrix B
For an m x n matrix multiplied by an
n x p matrix
These dimensions must match

100

200
300
400
500

100

200

300

400

500

mxn

nxp
The resulting matrix will have
these dimensions

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

We could use matrix


multiplication to solve the
problem in Example 9.1, in a
single step

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Matrix Powers

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

A2 is the same as A*A


A3 is the same as A*A*A

100

200
300
400
500

Raising a matrix to a power is


equivalent to multiplying it times itself
the requisite number of times

100

200

300

400

500

Raising a matrix to a power requires it to


have the name number of rows and
columns
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Matrix Inverse

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

MATLAB offers two approaches


The matrix inverse function
inv(A)

Raising a matrix to the -1 power

100

A-1

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Equivalent
approaches to
finding the
inverse of a
matrix

100

200
300
400
500

100

200

300

400

500

A matrix times its


inverse is the
identity matrix
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Not all matrices have an


inverse

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Called
Singular
Ill-conditioned matrices

100

200
300
400
500

100

200

300

400

500

Attempting to take the inverse of


a singular matrix results in an
error statement

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Determinants

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Related to the matrix inverse


If the determinant is equal to 0,
the matrix does not have an
inverse
The MATLAB function to find a
determinant is
det(A)
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Cross Products

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

sometimes called vector products


the result of a cross product is a
vector
always at right angles (normal) to
the plane defined by the two input
vectors
orthogonality
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Consider two vectors

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

A Ax i Ay j Az k

B Bx i B y j Bz k

200
300

The cross product is equal to

400
500

100

200

300

400

500

A B ( Ay * B z Az * B y )i ( Az * B x Ax * B z ) j ( Ax B y Ay B x )k
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Cross Products are Widely


Used

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

Cross products find wide use in


statics, dynamics, fluid mechanics
and electrical engineering
problems

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Solutions to Systems of
Linear Equations

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

3 x 2 y
x
x

100

200
300

z 10

3 y 2 z 5
y z 1

400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Using Matrix Nomenclature

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

3 2 1
A 1 3 2
1 1 1

x
X y
z

10
B 5
1

100

and

200
300
400
500

100

200

300

400

500

AX=B

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

We can solve this problem using


the matrix inverse approach

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

This approach is easy


to understand, but its
not the more efficient
computationally

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200

Matrix left division


uses Gaussian
elimination, which
is much more
efficient, and less
prone to round-off
error

300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Special Matrices

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

We introduced some of MATLABs


special matrices in previous
chapters
ones
zeros

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

The identity matrix is another


special matrix that is useful in
Matrix Algebra

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

It may be tempting
to name an identity
matrix i, however i
is already in-use
for imaginary
numbers

100

200
300
400
500

100

200

300

400

500

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Other matrices

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

pascal
magic
rosser

100

200
300
400
500

MATLAB includes a number of


matrices that are useful for testing
numerical techniques, computational
algorithms, or that are just interesting

100

200

300

400

500

gallery contains over 50 different test


matrices
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Matrix algebra and array


mathematics are significantly
different
The .*, ./ and .^ operators perform
element-by-element computations
The *, / and ^ operators transform
entire matrices
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary Dot Product

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

C Ai * Bi

100

200
300

i 1

400
500

The dot product is the sum of the


array multiplications of two equal
size vectors.

100

200

300

400

500

The MATLAB function for dot


products is dot(A,B)
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary Matrix
Multiplication

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

Matrix multiplication is similar to


the dot product
Each element of the result array
is a dot product

200
300

400
500

100

200

300

400

500

Ci , j Ai ,k Bk , j
k 1

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary - Inverse

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

A matrix times its inverse is equal


to the identity matrix
The MATLAB syntax to find a
matrix inverse is

200
300
400
500

100

200

300

400

500

inv(A)
A^-1

or

MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary - Determinants

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

The matrix inverse is related to


the determinant
If a matrix has a determinant
equal to zero it does not have an
inverse
The syntax for the determinant is
det(A)
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary Cross Products

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

100

200
300
400
500

100

200

300

400

500

Cross product is often called a


vector product
It produces a vector at right
angles to the two input vectors
The MATLAB syntax for cross
products is
cross(A,B)
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Summary Solving Linear


Systems of Equations

Rate of Change

-5

Rate of temperature change, degrees/hour

-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0

0.5

1.5

2.5

time, hour

3.5

4.5

Use the matrix inverse approach


X=inv(A)*B

Or use the left division approach


100

200
300
400
500

100

200

300

400

500

X=A\B
Left division uses Gaussian
elimination and is the preferred
approach
MATLAB for Engineers 2E, by Holly Moore. 2009 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions
Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

You might also like