Download Chapter 8

Document related concepts

Singular-value decomposition wikipedia , lookup

Four-vector wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Matrix calculus wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Gaussian elimination wikipedia , lookup

Matrix multiplication wikipedia , lookup

Transcript
Part 3 Chapter 8
Linear Algebraic
Equations and Matrices
1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Review of Matrix Algebra
Concepts
• Let’s take a look at a problem that can be
formulated using matrices
2
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Suppose there are three
jumpers connected by
bungee cords, so that each
cord is fully extended, but
unstretched.
After they are released,
gravity takes hold and the
jumpers will eventually
come to equilibrium
Suppose you are asked to
compute the displacement
of each of the jumpers –
that is x1, x2, x3.
3
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Free body diagrams
Assume that
each cord
behaves like a
linear spring,
and follows
Hooke’s Law
4
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Force Balance
d 2 x1
m1 2  m1 g  k2 ( x2  x1 )  k1 x1  0
dt
d 2 x2
m2 2  m2 g  k3 ( x3  x2 )  k2  x1  x2   0
dt
d 2 x3
m3 2  m3 g  k3 ( x2  x3 )  0
dt
Since the jumpers are at equilibrium the
acceleration is equal to 0
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
5
Rearrange
to give
3 equations
and…..
3 unknowns
m1 g  k2 ( x2  x1 )  k1 x1  0
m2 g  k3 ( x3  x2 )  k2  x1  x2   0
m3 g  k3 ( x2  x3 )  0
6
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Which
cansystem
be solved
using matrix
Linear
of equations
algebra
 k1  k2  x1  k2 x2  m1 g
k2 x1   k2  k3  x2  k3 x3  m2 g
k3 x2  k3 x3  m3 g
7
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Algebra
Applied Force
Chapter 9 in
MATLAB for
Engineers
20 feet
θ = 600
Pivot Point
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
F = 200 lbf
In this chapter we’ll learn how to…
• perform the basic operations of matrix
algebra
• solve simultaneous equations using
MATLAB matrix operations
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The difference between an array
and a matrix
• 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
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Arrays
• Technically an array is an orderly grouping
of information
– Arrays can contain numeric information, but
they can also contain character data,
symbolic data etc.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix
• The technical definition of a matrix is a twodimensional 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.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Algebra
• used extensively in engineering
applications
• Matrix algebra is different from the array
calculations we have performed thus far
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Array Operators
• 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
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Operators used in Matrix
Mathematics
•
•
•
•
•
Transpose
Multiplication
Division
Exponentiation
Left Division
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Some Matrix Algebra functions
•
•
•
•
Dot products
Cross products
Inverse
Determinants
Covered in
Applied Numerical
Methods
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Transpose
• In mathematics texts you will often see the
transpose indicated with superscript T
– AT
• The MATLAB syntax for the transpose is
– A'
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The transpose switches the rows
and columns
1 2 3
4 5 6

A
7 8 9


10 11 12
1 4 7 10
AT  2 5 8 11
3 6 9 12
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Using the transpose with complex
numbers
When used with complex
numbers, the transpose
operator returns the complex
conjugate
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Dot Products
• The dot product is sometimes called the
scalar product
• the sum of the results when you multiply
two vectors together, element by element.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
* *
*
||
||
||
+
+
Equivalent
statements
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 9.1
MATLAB for Engineers
Calculating the Center of Gravity
(Center of Mass)
• 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.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
xW  x1W1  x2W2  x3W3  etc...
yW  y1W1  y2W2  y3W3  etc...
zW  z1W1  z2W2  z3W3  etc...
• In a rectangular coordinate system
– x , y , and z are the coordinates of the center of gravity
– 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 masses of each system component
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
In this example…
• We’ll find the center of gravity of a small
collection of the components used in a
complex space vehicle
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Vehicle Component
Locations and Mass
Item
x, meters y, meters
z meters
Mass
Bolt
0.1
2
3
3.50 gram
screw
1
1
1
1.50 gram
nut
1.5
0.2
0.5
0.79 gram
bracket
2
2
4
1.75 gram
Formulate the problem using a dot product
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Input and Output
• Input
– Location of each component in an
x-y-z coordinate system – in meters
– Mass of each component, in grams
• Output
– Location of the center of gravity
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Hand Example
Find the x coordinate of the center of gravity
Item
Bolt
screw
nut
bracket
sum
x, meters
0.1
1
1.5
2
Mass,
gram
x 3.50
x 1.50
x * m, gram
meters
= 0.35
= 1.50
x 0.79
x 1.75
7.54
= 1.1850
= 3.5
6.535
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
We know that…
• The x coordinate is equal to
3
x
xm
i 1
i
mTotal
i
3

xm
i 1
3
i
i
m
i 1
i1
• So…
• x =6.535/7.54 = 0.8667 meters
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
This is a dot
product
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
We could use a plot to evaluate our
results
Center of Gravity
4
z-axis
3
This plot
was created
using the
interactive
plotting
tools
Center of Gravity
2
1
0
2
2
1
y-axis
1
0
0
x-axis
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Multiplication
• Similar to a dot product
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• 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
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
N
Ci , j   Ai ,k Bk , j
k 1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Because matrix multiplication is a
series of dot products
– the number of columns in matrix A
must equal the number of rows in
matrix B
– For an mxn matrix multiplied by an
nxp matrix
These dimensions must match
mxn
nxp
The resulting matrix will have
these dimensions
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
We could use matrix
multiplication to solve the
problem in Example 9.1, in a
single step
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Powers
• Raising a matrix to a power is equivalent to
multiplying it times itself the requisite number of
times
– A2 is the same as A*A
– A3 is the same as A*A*A
• Raising a matrix to a power requires it to have the
name number of rows and columns
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Inverse
• MATLAB offers two approaches
– The matrix inverse function
• inv(A)
– Raising a matrix to the -1 power
• A-1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Equivalent
approaches to
finding the
inverse of a
matrix
A matrix times its
inverse is the
identity matrix
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Not all matrices have an inverse
• Called
– Singular
– Ill-conditioned matrices
• Attempting to take the inverse of a singular
matrix results in an error statement
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Determinants
• 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)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
We’ll talk about
determinants
more in the next
chapter of
Applied
Numerical
Methods
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Cross Products
• 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
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Consider two vectors



A  Ax i  Ay j  Az k



B  Bx i  B y j  Bz k
The cross product is equal to…



A  B  ( Ay * Bz  Az * B y )i  ( Az * Bx  Ax * Bz ) j  ( Ax B y  Ay Bx )k
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
i

 Ax
 Bx

j
Ay
By
k

Az 
Bz 
 j

 Ay
 By

k
Az
Bz
i 

Ax 
Bx 
k

 Az
 Bz

i
Ax
Bx
j

Ay 
By 



A  B  ( Ay * Bz  Az * B y )i  ( Az * Bx  Ax * Bz ) j  ( Ax B y  Ay Bx )k
45
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Cross Products are Widely Used
• Cross products find wide use in statics,
dynamics, fluid mechanics and electrical
engineering problems
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solutions to Systems of Linear
Equations
3x 2 y
x
x
 z  10
3y 2 z  5
 y  z  1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Using Matrix Nomenclature
 3 2  1
 x
A   1 3 2  X   y 
 z 
 1  1  1
10 
B   5 
 1
and
AX=B
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Symbolically
 a11 a12
A   a21 a22
 a31 a32
a13 
 x1 
 b1 
a23  X   x2  B  b2 
 b3 
 x3 
a33 
and
AX=B
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
We can solve this problem using the matrix
inverse approach
This approach is easy
to understand, but its
not the most efficient
computationally
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix left division
uses Gaussian
elimination, which
is much more
efficient, and less
prone to round-off
error
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 8.2
Applied Numerical Methods
Bungee Jumpers
53
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Linear System of 3 Equations
 k1  k2  x1
 k2 x2
 m1 g
 k2 x1   k2  k3  x2  k3 x3  m2 g
 k3 x2  k3 x3  m3 g
Jumper
Mass (kg)
Spring Constant Unstretched Cord
(N/m)
Length (m)
Top (1)
60
50
20
Middle (2)
70
100
20
Bottom (3)
80
50
20
54
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
 150 100 0   x1  588.6 
 100 150 50  x   686.7 


 2 
 0
50 50   x3  784.8
55
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
56
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solution using the matrix
inverse strategy
Solution using left division
57
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Linear Algebraic Equations find
wide use in Engineering
58
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.