EGR 106 Week 4 Math on Arrays - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

EGR 106 Week 4 Math on Arrays

Description:

Row/column based operations. Rest of chapter 3. Array Multiplication ... cable tensions in statics. fluid flow in piping. heat flow in thermodynamics. e.g. v ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 26
Provided by: gatew318
Category:
Tags: egr | arrays | math | statics | week

less

Transcript and Presenter's Notes

Title: EGR 106 Week 4 Math on Arrays


1
EGR 106 Week 4 Math on Arrays
  • Linear algebraic operations
  • Multiplication
  • Division
  • Row/column based operations
  • Rest of chapter 3

2
Array Multiplication (Linear Algebra)
  • In linear algebra, the matrix expression F A
    B means
  • Entries are dot products of rows of the first
    matrix with columns of the second

3
  • For example

a
b
c
d
a1xc1 b1xc2 a1xd1 b1xd2
4
  • Notes
  • The operation is generally not commutative
  • AB ? BA
  • The number of columns of the 1st must match the
    number of rows of the 2nd

n by k
k by m
n by m
5
  • For example, here multiplication works both ways,
    but is not commutative

quite different!
6
Multiplications FAB (2col, 2 rows)
  • 1x72x8 1x92x10 1x112x12
  • 23 29 35
  • 3x74x8 3x94x10 3x114x12
  • 53 67 81
  • 5x76x8 5x96x10 5x116x12
  • 83 105 127

7
Multiplications FBA (3cols, 3rows)
  • 7x19x311x5 7x29x411x6
  • 89 116
  • 8x110x312x5 8X210x412x6
  • 98 128

8
  • And here it doesnt work at all

(2 cols, 3 rows)
9
Application of Multiplication
  • Application of matrix multiplication n
    simultaneous equations in m unknowns (the xs)

n rows, m columns
10
  • For example
  • In matrix form this is A x b
  • with

Coefficients
11
  • In general A x b
  • A is n by m
  • x is m by 1
  • b is n by 1


column vectors (lower case)
12
  • Usages finding
  • cable tensions in statics
  • fluid flow in piping
  • heat flow in thermodynamics
  • e.g.
  • v
  • currents in circuits
  • traffic flow
  • economics

R1
R3
R2
13
Array Division
  • Recall the command eye(n)
  • This result is the array
  • multiplication identity matrix I
  • For any array A
  • A I I A A

must be properly sized!
14
  • Imagine that for square arrays A and B we have
  • A B B A I
  • then we call them inverses
  • A B1 B A1
  • In Matlab A -1 or inv(A)
  • When does A1 exist?
  • A is square
  • A has a non-zero determinant (det(A))

15
  • For example

(Must be non zero for inv)
16
  • Solving A x b
  • Assume that A is square and det(A) ? 0
  • Multiply both sides by A1 on the left
  • A1 A x A1 b
  • so x A1 b
  • In Matlab, x A \ b or x inv(A)b

I
x
backwards slash
17
9x28x36 7x14x25x38 4x14x22x30
  • For example
  • Check your work

x1 x2 x3
18
Vector Based Operations
  • Some operations analyze a vector to yield a
    single value. For example

sums the elements
19
  • Other operations for a vector A
  • Minimum min(A)
  • Maximum max(A)
  • Median median(A)
  • Mean or average mean(A)
  • Standard deviation std(A)
  • Product of the elements prod(A)

20
  • Some operators yield two results
  • min and max can yield both the value and its
    location
  • default is the first result

21
  • Some operators yield vector results
  • size(A) weve already seen
  • sort

22
  • Or multiple vectors

23
  • Finally, when applied to an array, these
    operators perform their action on columns

24
  • Unless you instruct it to work on rows!

the 2 means use the 2nd dimension i.e. spanning
the columns
25
  • Use help to discover how to use these work
Write a Comment
User Comments (0)
About PowerShow.com