+ All Categories
Home > Documents > CMPS 1371 Introduction to Computing for Engineers MATRICES.

CMPS 1371 Introduction to Computing for Engineers MATRICES.

Date post: 01-Jan-2016
Category:
Upload: walter-hubert-pierce
View: 224 times
Download: 2 times
Share this document with a friend
Popular Tags:
35
CMPS 1371 Introduction to Computing for Engineers MATRICES
Transcript
Page 1: CMPS 1371 Introduction to Computing for Engineers MATRICES.

CMPS 1371Introduction to

Computing for Engineers

MATRICES

Page 2: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix vs Array

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

Page 3: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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.

Page 4: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix

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.

Page 5: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix Algebra

used extensively in engineering applications

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

Page 6: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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

Page 7: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Operators used in Matrix Mathematics

TransposeMultiplicationDivisionExponentiationLeft Division

Page 8: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Some Matrix Algebra functions

Dot products

Cross products

Inverse

Determinants

Page 9: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Transpose

In mathematics texts you will often see the transpose indicated with superscript T AT

The MATLAB syntax for the transpose is A'

Page 10: CMPS 1371 Introduction to Computing for Engineers MATRICES.

úúúú

û

ù

êêêê

ë

é

=

121110

987

654

321

Aúúú

û

ù

êêê

ë

é=

12963

11852

10741TA

The transpose switches the rows and columns

Page 11: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Transpose

Page 12: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Using the transpose with complex numbers

When used with complex numbers, the transpose operator returns the complex conjugate

Page 13: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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.

Page 14: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Equivalent statements

Page 15: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix Multiplication

Similar to a dot product

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

Page 16: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix Multiplication

Page 17: CMPS 1371 Introduction to Computing for Engineers MATRICES.
Page 18: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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

m x n n x p

These dimensions must match

The resulting matrix will have these dimensions

Matrix Multiplication

Page 19: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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

Page 20: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Matrix Inverse

MATLAB offers two approaches

The matrix inverse function inv(A)

Raising a matrix to the -1 power A-1

Page 21: CMPS 1371 Introduction to Computing for Engineers MATRICES.

A matrix times its inverse is the identity matrix

Equivalent approaches to finding the inverse of a matrix

Page 22: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Not all matrices have an inverse

These matrices are called: Singular Ill-conditioned matrices

Attempting to take the inverse of a singular matrix results in an error statement

Page 23: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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)

Page 24: CMPS 1371 Introduction to Computing for Engineers MATRICES.
Page 25: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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

Page 26: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Consider two vectors

kAjAiAA zyx

rrr++=

kBjBiBB zyx

rrr++=

kBABAjBABAiBABABA xyyxzxxzyzzy

rrr)()**()**( -+-+-=´

The cross product is equal to…

Page 27: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Cross Products

Page 28: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Cross Products are Widely Used

Cross products find wide use in statics, dynamics, fluid mechanics and electrical engineering problems

Page 29: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Solutions to Systems of Linear Equations

3 2 10

3 2 5

1

x y z

x y z

x y z

+ - =- + + =

- - = -

Page 30: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Using Matrix Nomenclature

úúú

û

ù

êêê

ë

é

---

-=

111

231

123

Aúúú

û

ù

êêê

ë

é=

z

y

x

Xúúú

û

ù

êêê

ë

é

-=

1

5

10

B

and

AX=B

Page 31: CMPS 1371 Introduction to Computing for Engineers MATRICES.

We can solve this problem using the matrix inverse approach

This approach is easy to understand, but its not the more efficient computationally

Page 32: CMPS 1371 Introduction to Computing for Engineers MATRICES.

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

Page 33: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Special Matrices

We introduced some of MATLAB’s special matrices in previous chapters ones zeros

Page 34: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Identity Matrix

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

The identity matrix is another special matrix that is useful in Matrix Algebra

Page 35: CMPS 1371 Introduction to Computing for Engineers MATRICES.

Other Matrices

MATLAB includes a number of matrices that are useful for testing numerical techniques, computational algorithms, or that are just interesting pascal magic Rosser

gallery – contains over 50 different test matrices


Recommended