EGR 106 – Week 4 – Math on Arrays

Slides:



Advertisements
Similar presentations
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Advertisements

Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
EGR 106 – Week 4 – Math on Arrays
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Matrix Mathematics in MATLAB and Excel
Finding the Inverse of a Matrix
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
A Fast Introduction inverse matrix1 What is a matrix (One Matrix many matrices) Why do they exist Matrix Terminology Elements Rows Columns Square.
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 10 Review: Matrix Algebra
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Matlab Chapter 2: Array and Matrix Operations. What is a vector? In Matlab, it is a single row (horizontal) or column (vertical) of numbers or characters.
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
Chapter 4 Matrices By: Matt Raimondi.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
The inverse of a Square Matrix 2.1 Day 1 (Out of Pre-Calc book 8.3) We are reloading for another chapter.
Matrix Computations ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 5 Systems and Matrices Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Lecture 28: Mathematical Insight and Engineering.
Unit 6 : Matrices.
13.6 MATRIX SOLUTION OF A LINEAR SYSTEM.  Examine the matrix equation below.  How would you solve for X?  In order to solve this type of equation,
Algebra 3: Section 5.5 Objectives of this Section Find the Sum and Difference of Two Matrices Find Scalar Multiples of a Matrix Find the Product of Two.
Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x x.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 22P. 1Winter Quarter MATLAB: Simultaneous Equations Lecture 22.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Matrix Computations ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Chiang & Wainwright Mathematical Economics
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 22P. 1Winter Quarter MATLAB: Simultaneous.
Multiplying Matrices Algebra 2—Section 3.6. Recall: Scalar Multiplication - each element in a matrix is multiplied by a constant. Multiplying one matrix.
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
TH EDITION LIAL HORNSBY SCHNEIDER COLLEGE ALGEBRA.
Use Inverse Matrices to Solve Linear Systems Objectives 1.To find the inverse of a square matrix 2.To solve a matrix equation using inverses 3.To solve.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
Linear System of Simultaneous Equations Warm UP First precinct: 6 arrests last week equally divided between felonies and misdemeanors. Second precinct:
Linear Algebra Review Tuesday, September 7, 2010.
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
Matrices Introduction.
College Algebra Chapter 6 Matrices and Determinants and Applications
MTH108 Business Math I Lecture 20.
Elementary Matrix Theory
Solving Linear Systems Syed Nasrullah
A Fast Introduction What is a matrix (One Matrix many matrices)
Introduction What is a matrix (One Matrix many matrices)
Linear Algebraic Equations and Matrices
Linear Algebra review (optional)
Linear Algebra Lecture 2.
Chapter 7 Matrix Mathematics
Finding the Inverse of a Matrix
Linear Algebraic Equations and Matrices
L9Matrix and linear equation
Multiplying Matrices Algebra 2—Section 3.6.
Systems of First Order Linear Equations
Matrix Algebra.
7.3 Matrices.
Introduction to MATLAB Lecture 02
Math-2 (honors) Matrix Algebra
Lecture 11 Matrices and Linear Algebra with MATLAB
Unit 3: Matrices
Array and Matrix Functions
Matrices.
Matrix Algebra.
Inverse of a Matrix Solving simultaneous equations.
Linear Algebra review (optional)
Matrices in MATLAB Dr. Risanuri Hidayat.
Presentation transcript:

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

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 = *

For example: a b c d a1xc1 + b1xc2 a1xd1 + b1xd2

Notes: The operation is generally not commutative A*B ≠ B*A The number of columns of the 1st must match the number of rows of the 2nd = * n by m n by k k by m

For example, here multiplication works both ways, but is not commutative: quite different!

Multiplications F=A*B (2col, 2 rows) 1x7+2x8 1x9+2x10 1x11+2x12 23 29 35 3x7+4x8 3x9+4x10 3x11+4x12 53 67 81 5x7+6x8 5x9+6x10 5x11+6x12 83 105 127

Multiplications F=B*A (3cols, 3rows) 7x1+9x3+11x5 7x2+9x4+11x6 89 116 8x1+10x3+12x5 8X2+10x4+12x6 98 128

And here it doesn’t work at all: (2 cols, 3 rows)

Application of Multiplication Application of matrix multiplication: n simultaneous equations in m unknowns (the x’s) n rows, m columns

In matrix form this is A * x = b with For example: In matrix form this is A * x = b with Coefficients

column vectors (lower case) In general: A * x = b A is n by m x is m by 1 b is n by 1 column vectors (lower case)

Usages – finding: v cable tensions in statics fluid flow in piping heat flow in thermodynamics e.g. v currents in circuits traffic flow economics R1 R3 R2

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!

Imagine that for square arrays A and B we have A * B = B * A = I then we call them inverses A = B–1 B = A–1 In Matlab: A ^ -1 or inv(A) When does A–1 exist? A is square A has a non-zero determinant (det(A))

For example: (Must be non zero for inv)

A–1 *A * x = A–1* b so x = A–1* b = I = x Solving A * x = b Assume that A is square and det(A) ≠ 0 Multiply both sides by A–1 on the left A–1 *A * x = A–1* b so x = A–1* b In Matlab, x = A \ b or x = inv(A)*b = I = x backwards slash

For example: Check your work: 9x2+8x3=6 7x1+4x2+5x3=8 4x1+4x2+2x3=0 x1

Vector Based Operations Some operations analyze a vector to yield a single value. For example: sums the elements

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)

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

Some operators yield vector results size(A) we’ve already seen sort

Or multiple vectors:

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

the 2 means “use the 2nd dimension” i.e. spanning the columns Unless you instruct it to work on rows! the 2 means “use the 2nd dimension” i.e. spanning the columns

Use help to discover how to use these work