Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G<50 count = count +1; disp(G); end The code inside the if statement is.

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

CMPS 1371 Introduction to Computing for Engineers
1.5 Elementary Matrices and a Method for Finding
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
Ch 7.2: Review of Matrices For theoretical and computation reasons, we review results of matrix theory in this section and the next. A matrix A is an m.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
ECIV 520 Structural Analysis II Review of Matrix Algebra.
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
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
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.
1 Chapter 2 Matrices Matrices provide an orderly way of arranging values or functions to enhance the analysis of systems in a systematic manner. Their.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrix Solution of Linear Systems The Gauss-Jordan Method Special Systems.
Chapter 10 Review: Matrix Algebra
Chapter 2 Solving Linear Systems Matrix Definitions –Matrix--- Rectangular array/ block of numbers. –The size/order/dimension of a matrix: (The numbers.
ECON 1150 Matrix Operations Special Matrices
Matrices Square is Good! Copyright © 2014 Curt Hill.
Basic Operations MultiplicationDeterminants Cramer’s RuleIdentityInverses Solving Systems of equations APPENDIX.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Review for Chapter 4 Important Terms, Symbols, Concepts 4.1. Systems of Linear Equations in Two Variables.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
4.6 Matrix Equations and Systems of Linear Equations In this section, you will study matrix equations and how to use them to solve systems of linear equations.
Fin500J Mathematical Foundations in Finance Topic 1: Matrix Algebra Philip H. Dybvig Reference: Mathematics for Economists, Carl Simon and Lawrence Blume,
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Lecture 28: Mathematical Insight and Engineering.
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.
ENE MATHLAB ® Lecture 3: Matrix Review. Determinant  To use MATLAB to compute determinants:  Enter the determinant as an array.  Use ‘det’ command.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Linear algebra: matrix Eigen-value Problems Eng. Hassan S. Migdadi Part 1.
Matrices Matrices A matrix (say MAY-trix) is a rectan- gular array of objects (usually numbers). An m  n (“m by n”) matrix has exactly m horizontal.
Working with Arrays in MATLAB
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.
ME 142 Engineering Computation I Matrix Operations in Excel.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
8.2 Operations With Matrices
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Chapter 5: Matrices and Determinants Section 5.5: Augmented Matrix Solutions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 8 Linear Algebraic Equations and Matrices.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
College Algebra Chapter 6 Matrices and Determinants and Applications
Solving Linear Systems Syed Nasrullah
Linear Algebraic Equations and Matrices
Linear Algebra review (optional)
Chapter 7 Matrix Mathematics
Repetition Structures Chapter 9
Linear Algebraic Equations and Matrices
L9Matrix and linear equation
Matrix Operations SpringSemester 2017.
Chapter 7: Matrices and Systems of Equations and Inequalities
Matrix Solutions to Linear Systems
ARRAY DIVISION Identity matrix Islamic University of Gaza
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
LINEAR EQUATIONS.
3.6 Multiply Matrices.
LINEAR EQUATIONS.
Matrix Operations SpringSemester 2017.
Presentation transcript:

Finishing up Chapter 5

Will this code enter the if statement? G=[30,55,10] if G<50 count = count +1; disp(G); end The code inside the if statement is not executed, because the comparison is not true!!

For Loops for index = [matrix] commands to be executed end The loop starts with a for statement, and ends with the word end. The first line in the loop defines the number of times the loops will repeat, using an index number. The loop is executed once for each element of the index matrix identified in the first line The index of a for loop must be a variable.

Here’s a simple example In this case k is the index – the loop is repeated once for each value of k the index can be defined using any of the techniques we’ve learned

While Loops while criterion commands to be executed end While loops are very similar to for loops. The big difference is the way MATLAB decides how many times to repeat the loop. While loops continue until some criterion is met.

This loop creates the matrix a, one element at a time

Improving the Efficiency of Loops In general, using a for loop (or a while loop) is less efficient in MATLAB than using array operations.

Chapter 6: Mathematical Insight and Engineering

What is A’? >> A = [1, 2, 3; 4, 3, 6]; >> A’ A B C D This is the transpose= the rows and columns are flipped

What is C? >> A = [1, 2, 3]; >> B = [4, 2, 1]; >> C=dot(A,B) A B. 11 C D Dot product = sum of the elements in vector A multiplied by same elements in vector B

What is C? >> A = [1, 2, 3; 3, 2, 1]; >> B = [1, 1; 1, 1; 1, 1]; >> C=A*B A B. 11 C D Matrix multiplication= dot product of each row of A with each column of B

Matrix Inverse MATLAB offers two approaches The matrix inverse function  inv(A) Raising a matrix to the -1 power  A -1

A matrix times its inverse is the identity matrix Equivalent approaches to finding the inverse of a matrix

Not all matrices have an inverse Called Singular Ill-conditioned matrices Attempting to take the inverse of a singular matrix results in an error statement

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)

What is B? >> A = [1, 2; 3, 2]; >> B=det(A) A.0B. 4 C. -4 D. 8 Don’t have to know the mathematics of the determinent

Solutions to Systems of Linear Equations

Using Matrix Nomenclature and AX=B

We can solve this problem using the matrix inverse approach This approach is easy to understand, but its not the more efficient computationally

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

What is C? >> A = [1, 0; 0, 1]; >> B = [5; 2] >> C = inv(A)*B A.1 1B. 5 2 C. 5 1 D.5 2 Don’t have to know the mathematics of the determinent

In-class assignment – Chapter 6 problems 3, 7, 8, and 10