ME 142 Engineering Computation I Matrix Operations in Excel.

21
ME 142 Engineering Computation I Matrix Operations in Excel

Transcript of ME 142 Engineering Computation I Matrix Operations in Excel.

Page 1: ME 142 Engineering Computation I Matrix Operations in Excel.

ME 142Engineering Computation I

Matrix Operations

in

Excel

Page 2: ME 142 Engineering Computation I Matrix Operations in Excel.

Key Concepts

Matrix Basics

Matrix Addition

Matrix Multiplication

Transposing a Matrix

Inverting a Matrix

The Determinant of a Matrix

Matrix Inversion Method

Cramer’s Rule

Page 3: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Basics

What is a Matrix? A matrix may be defined as a collection of numbers, arranged into

rows and columns

6118

427

532

D

Page 4: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Basics

Named cells may be used to define arrays Simplifies process Makes formulas easier to understand

Pre-select the array output area Use [Shift]+[Ctrl]+[Enter] key combination to execute array

commands Populates each cell in array output area with array command

Page 5: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Addition

238

541A

476

305B

61014

246ResultAxB

The 2 matrices to be added must be the same size Matrices are added element by element

Page 6: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Addition

=A+B [Shift]+[Cntl]+[Enter]

Page 7: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Multiplication

In order to multiply 2 matrices, the number of columns in the first matrix must equal the number of rows in the second matrix

Elements in the results matrix are obtained by performing a product-sum of each row in the first matrix by each column in the second matrix

Page 8: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Multiplication

238

541A

23

41

51

B

Row1,col1: 1*1 + 4*(-1) +5*3 = 12 Row1,col2: 1*5 + 4*4 + 5*2 = 31 Row2,col1: 8*1 + 3*(-1) + 2*3 = 11 Row2,col2: 8*5 + 3*4 + 2*2 = 56

5611

3112)(Results AxB

Page 9: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Multiplication: AxB

=MMULT(A,B) [Shift]+[Cntl]+[Enter]

Page 10: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Multiplication: BxA

=MMULT(B,A) [Shift]+[Cntl]+[Enter]

Page 11: ME 142 Engineering Computation I Matrix Operations in Excel.

Transposing a Matrix

=TRANSPOSE(A) [Shift]+[Cntl]+[Enter]

238

541A

25

34

81

transposedA

To transposing a matrix simply switch the rows and columns

Any matrix can be transposed

Page 12: ME 142 Engineering Computation I Matrix Operations in Excel.

Inverting a Matrix

100

010

001 A matrix multiplied by its inverse matrix results in the identity matrix

The inverse of a matrix can be useful in solving simultaneous equations

Only square matrices (equal number of rows and columns) are possible to invert

Not all square matrices can actually be inverted

3x3 Identity Matrix

Page 13: ME 142 Engineering Computation I Matrix Operations in Excel.

Inverting a Matrix

6118

427

532

D

081.0009.0289.0

128.0133.0047.0

009.0175.0152.0

inverseD

Page 14: ME 142 Engineering Computation I Matrix Operations in Excel.

Inverting a Matrix

=MINVERSE(D) [Shift]+[Cntl]+[Enter]

Page 15: ME 142 Engineering Computation I Matrix Operations in Excel.

Determinant of a Matrix

The determinant of a matrix is a single value, calculated by performing a product-sum on the rows and columns in a matrix

The determinant of a matrix can be useful in solving simultaneous equations

Only square matrices (equal number of rows and columns) have a determinant

Page 16: ME 142 Engineering Computation I Matrix Operations in Excel.

Determinant of a Matrix

=MDETERM(D)

6118

427

532

D Determinant = 211

Recopy first 2 columns Multiply and sum diagonals to the right Multiply and sum diagonals to the left Difference of sum is determinant

1186118

27427

32532

(2*2*6 + 3*4*8 + 5*7*11) – (5*2*8 + 2*4*11 + 3*7*6)

Page 17: ME 142 Engineering Computation I Matrix Operations in Excel.

Matrix Inversion Method

BAX 1

333231

232221

131211

aaa

aaa

aaa

A

3

2

1

x

x

x

X

3

2

1

b

b

b

B

BXA

BAXAA 11

Given linear system of equations in matrix form:

Where

Then multiplying both sides by [A-1], the inversion of [A]

Page 18: ME 142 Engineering Computation I Matrix Operations in Excel.

Cramer’s Rule

This rule states that each unknown in a system of linear equations may be expressed as a fraction of two determinants.

The determinant of the denominator, D, is obtained from the coefficients of matrix [A]

The determinant of the numerator is obtained from D by replacing the column of coefficients of the unknown in question by the coefficients of matrix [B]

Page 19: ME 142 Engineering Computation I Matrix Operations in Excel.

Cramer’s Rule

333231

232221

131211

aaa

aaa

aaa

A

3

2

1

x

x

x

X

3

2

1

b

b

b

B

BXA

Given linear system of equations in matrix form:

Where

Page 20: ME 142 Engineering Computation I Matrix Operations in Excel.

Cramer’s Rule

Then the determinant of [A] may be defined as:

And values of [X] may be found from the expressions below:

333231

232221

131211

aaa

aaa

aaa

D

D

aab

aab

aab

x 33323

23222

13121

1 D

aba

aba

aba

x 33331

23221

13111

2 D

baa

baa

baa

x 33231

22221

11211

3

Page 21: ME 142 Engineering Computation I Matrix Operations in Excel.

Cramer’s Rule

Useful in solving systems of 2 or 3 linear equations, by hand or by computer