CS1371 Computing for Engineers - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

CS1371 Computing for Engineers

Description:

How to create, edit and run scripts. Basic vector operations ... Raw material Analysis. This is what. You buy. This is what is contained. 16. 9/4/09. Targets ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 24
Provided by: BillL161
Category:

less

Transcript and Presenter's Notes

Title: CS1371 Computing for Engineers


1
CS1371 Computing for Engineers
  • Lecture 4
  • Arrays/Matrices

2
(No Transcript)
3
What should you should know now
  • How to start(and stop) Matlab
  • Basic operations and trix! (Up arrow,etc.)
  • How to do simple calculations in the command
    window
  • How to create, edit and run scripts
  • Basic vector operations
  • Creation
  • Addition/Subtraction/Multiplications/etc.
  • Element by element operations
  • Slicing
  • Logic operations

4
This Week
  • Today
  • Basic Arrays/Matrices
  • Conditionals
  • Thursday
  • Functions

5
Arrays and Matrices
  • Vectors -gt Arrays -gt Matrices
  • Two-dimensional

Jagged arraywe Wont use these!
6
Properties
  • sz size(array)
  • rows, cols size(array)
  • length(array)
  • transpose '

7
Properties
  • Special cases
  • Square
  • Diagonal
  • row vector/column vector

8
Array Creation
  • Direct entry with semicolons () separating rows
  • still works!
  • zeros, one, rand, diag, magic

9
Array Access
  • Retrieving/Storing/Removing
  • Matlabs dirty little secret

10
Array Operations
  • Arithmetic
  • Scaler ops (. ./ .)
  • Matrix ops
  • Logical
  • Concatenation
  • Slicing

11
Slicing
  • B(ltrangex1gt,ltrangey1) A(ltrangex2gt, ltrangey2gt)

12
Matrices
  • Arthur Cayley (1821-1895)
  • Inventor of Matrices
  • "When Cayley invented matrices in the late 19th
    century he was proud of the fact that they were
    absolutely useless. " - Steven Krantz
    Mathematician Washington University

13
Matlab Excels in Matrix Operations
  • This separates Matlab from high-level languages
    like C, FORTRAN, etc.
  • Some operations supported
  • A' transpose of A
  • inv(A) inverse of the matrix
  • det(A) determinant of the matrix
  • rank(A) rank of the matrix
  • trace(A) sum of diagonal terms
  • sqrtm(A) matrix square root
  • (i.e., if Bsqrtm(A), then ABB)
  • norm(A) matrix norm (useful for vector
    magnitudes)
  • eig(A) eigenvalues and eigenvectors of matrix

14
But who cares?
  • A large and very useful area of mathematics deals
    with what is called linear algebra and matrices
    are an integral part of this.
  • Many advanced computational methods in
    engineering make extensive use of linear algebra,
    and hence of matrices

15
Example Simultaneous Equations
This is what is contained
This is what You buy
16
Targets
Batch Size 100 kilograms
17
Unknowns
  • w - kg of Feldspar
  • x kg of Diatomite
  • y kg of Magnesite
  • z kg of Talc

18
How much silica will we have?
19
How much silica will we have?
20
What is the constraint?
21
Set of Simultaneous Equations
22
Expressing in Matrix Format
23
Two ways to solve
  • Using the Inverse
  • Ax b
  • Using matrix division
  • Ax b
Write a Comment
User Comments (0)
About PowerShow.com