ENGR 1181 MATLAB 4: Array Operations

Similar documents
Mathematical Operations with Arrays and Matrices

3. Replace any row by the sum of that row and a constant multiple of any other row.

Maths for Signals and Systems Linear Algebra in Engineering. Some problems by Gilbert Strang

x = 12 x = 12 1x = 16

ENGR 1181 MATLAB 02: Array Creation

Topic 3. Mathematical Operations Matrix & Linear Algebra Operations Element-by-Element(array) Operations

Introduction to Engineering gii

Equations and Problem Solving with Fractions. Variable. Expression. Equation. A variable is a letter used to represent a number.

Curriculum Map: Mathematics

Array Accessing and Strings ENGR 1187 MATLAB 3

Array Accessing and Strings ENGR 1181 MATLAB 3

ENGR 1181 MATLAB 09: For Loops 2

Introduction to Matlab. By: Hossein Hamooni Fall 2014

Lecture 12 (Last): Parallel Algorithms for Solving a System of Linear Equations. Reference: Introduction to Parallel Computing Chapter 8.

SCIE 4101, Spring Math Review Packet #4 Algebra II (Part 1) Notes

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

Topic 1.6: Lines and Planes

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Math 355: Linear Algebra: Midterm 1 Colin Carroll June 25, 2011

MAT 003 Brian Killough s Instructor Notes Saint Leo University

Game Mathematics. (12 Week Lesson Plan)

Fractions. There are several terms that are commonly used when working with fractions.

A Survey of Mathematics with Applications 8 th Edition, 2009

Mastery. PRECALCULUS Student Learning Targets

One-dimensional Array

ENGI Introduction to Computer Programming M A Y 2 8, R E Z A S H A H I D I

Table of Contents. Introduction to the Math Practice Series...iv Common Mathematics Symbols and Terms...1

Introduction to Matrix Operations in Matlab

Introduction to MatLab. Introduction to MatLab K. Craig 1

Wits Maths Connect Secondary Project Card-sorting Activities

Review Ch. 15 Spreadsheet and Worksheet Basics. 2010, 2006 South-Western, Cengage Learning

CAMBRIDGE TECHNOLOGY IN MATHS Year 11 TI-89 User guide

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

ENGR 1181c Midterm Exam 2: Study Guide and Practice Problems

LAB 2: Linear Equations and Matrix Algebra. Preliminaries

PART 1 PROGRAMMING WITH MATHLAB

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Introduction to MATLAB for Engineers, Third Edition

MATH 423 Linear Algebra II Lecture 17: Reduced row echelon form (continued). Determinant of a matrix.

1.8 Intro to Variables, Algebraic Expressions, and Equations

Math 2250 MATLAB TUTORIAL Fall 2005

Lecture Notes Order of Operations page 1

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information

Chapter 0: Algebra II Review

FUNDAMENTAL ARITHMETIC

Algorithms and Data Structures

7/25/2016. Example: Addition of Unsigned Bit Patterns. ECE 120: Introduction to Computing. Adding Two Non-Negative Patterns Can Overflow

ENGR 1181 Autumn 2015 Final Exam Study Guide and Practice Problems

Exponential Notation

A Guide to Using Some Basic MATLAB Functions

Column and row space of a matrix

Subject: Computer Science

Solve the matrix equation AX B for X by using A.(1-3) Use the Inverse Matrix Calculator Link to check your work

CS184: Using Quaternions to Represent Rotation

Introduction to MATLAB 7 for Engineers

Module 7 Highlights. Mastered Reviewed. Sections ,

The School District of Palm Beach County Fourth Grade Mathematics Scope st Trimester

AH Matrices.notebook November 28, 2016

MATH 5520 Basics of MATLAB

MATH 3511 Basics of MATLAB

Vector Algebra Transformations. Lecture 4

Chapter 1: Number and Operations

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120

Physics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.

Armstrong State University Engineering Studies MATLAB Marina 2D Arrays and Matrices Primer

Chapter 7: Programming in MATLAB

Computer & Careers Mr. Lewis

Matlab Introduction. Scalar Variables and Arithmetic Operators

AN INTRODUCTION TO MATLAB

Arrays and Matrix Operations

Finite Math - J-term Homework. Section Inverse of a Square Matrix

The City School PECHS Junior Boys 2 nd Term Ms Excel- Task 2, 3-Worksheet

Common Core Vocabulary and Representations

X Std. Topic Content Expected Learning Outcomes Mode of Transaction

Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology. Scotland T 3. Matrices. Teachers Teaching with Technology (Scotland)


Introduction to MATLAB

Vocabulary Cards and Word Walls. Ideas for everyday use of a Word Wall to develop vocabulary knowledge and fluency by the students

GRAPHING CALCULATOR REFERENCE BOOK

Ahigh school curriculum in Algebra 2 contains both solving systems of linear equations,

Chapter 1: Foundations for Algebra

MAT 090 Brian Killough s Instructor Notes Strayer University

Arithmetic and Logic Blocks

ENGR 1181 MATLAB 15: Functions 2

Introduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003

Introduction to Matlab

Lecture 2. Arrays. 1 Introduction

Fuzzy Set, Fuzzy Logic, and its Applications

Vocabulary Cards and Word Walls

Dynamics and Vibrations Mupad tutorial

RELEASED. NC Final Exam. NC Math 3. Released Items. Student Name:

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

Lecture 2: Variables, Vectors and Matrices in MATLAB

February 01, Matrix Row Operations 2016 ink.notebook. 6.6 Matrix Row Operations. Page 49 Page Row operations

2 1 = 1; 1 1 = 0; 0 1 = 1; 1 1 = 2

MATLAB An introductory tutorial

Franklin Math Bowl 2008 Group Problem Solving Test Grade 6

Watkins Mill High School. Algebra 2. Math Challenge

Go Math 3 rd Grade Meramec Valley R-3 School District. Yearly Plan. 1 Updated 6/24/16

Transcription:

ENGR 81 MTL 4: rray Operations Learning Objectives 1. Explain meaning of element-by-element operations. Identify situations where the standard operators in MTL (when used with arrays) are reserved for linear algebra, which is not always element-by-element 3. pply dot operators for a. The six cases where linear algebra is not element-by-element and therefore dot operators are needed to produce element-by-element calculations Topics Students will read Chapter 3.4 3.8 of the MTL book before coming to class. This preparation material is provided to supplement this reading. Students will learn a basic understanding of array operations in MTL. This material contains the following: 1. Matrix rithmetic Overview a. Matrix Math (beyond this class) b. Element-by-Element rithmetic. Scalar-rray rithmetic 3. rray-rray rithmetic 4. Dot Operators 5. Element-by-Element Examples 6. uilt-in rray Functions 7. pplication of rray Operations 1. Matrix rithmetic Overview There are two types of matrix arithmetic: 1. Matrix math is used in Linear lgebra to solve simultaneous equations. This is beyond the scope of this course, but can be read about in Chapter. 3. and 3.3.. This course introduces element-by-element arithmetic. If = [a b c] and = [x y z], then + = [a+x b+y c+z] 1

ENGR 81 MTL 4: rray Operations If and are matrices and s is a scalar, then: There are only six cases where matrix math and element-by-element arithmetic differ * / ^ ^s s^ s/ For these cases, the standard operator has been chosen to represent matrix arithmetic, so we need a new symbol for element-by element arithmetic (dot operators).*./.^.^s s.^ s./ The arrays must be the same size for matrix arithmetic. Element-by-element operations for row vectors: If: a = [a1 a a3] and b = [b1 b b3] Then: a.* b = [ a 1 * b 1 a * b a 3* b 3 ] a./ b = [ a 1 / b 1 a / b a 3 / b 3 ] a.^ b = [ a 1^b 1 a ^b a 3^b 3 ] a.^ = [ a 1^ a ^ a 3^ ]./a = [ /a 1 /a /a 3 ]. Dot Operators Given the matrices and : 1 1 3 3 1 1 3 3 Then, the following dot operations are true: Multiplication.* 1 1 1 3 1 3 3 3 Division (vector by vector) /./ 1/ / 1 / 1 3 / / 1 3 / 3 / 3 /

ENGR 81 MTL 4: rray Operations Division (scalar by vector) 6./ 6/ 6/ 6/ 1 6/ 6/ 6/ 1 3 6/ 6/ 6/ 3 Exponential (vector to scalar).^ 1 1 3 3 If you forget a dot when one is required, you will either get a cryptic error message (involving matrix dimensions) or you will get the wrong answer. For certain operations, matrix math is the same as element-by-element arithmetic, so dot operators are optional. This is true for the following operations: s+ s- -s + - s* /s 3. Scalar-rray rithmetic Scalar-rray ddition and Subtraction The scalar operates on each element in the array. For example, given the following matrix M and the scalar s = we would get the following results for addition and subtraction. 3

ENGR 81 MTL 4: rray Operations Scalar-rray Multiplication and Division The scalar operates on each element in the array For example, given the same matrix M and scalar s = we would get the following results for multiplication and division 4

ENGR 81 MTL 4: rray Operations 4. rray-rray rithmetic rray-rray ddition and Subtraction The arrays being used in the operation must have the same size. The sum (difference) of two arrays is obtained by adding (subtracting) corresponding array elements, resulting in a new array of the same size. 5

ENGR 81 MTL 4: rray Operations 5. Element-by-Element Examples Given the following matrices and : >> = [1,, 3; 4, 5, 6] = 1 3 4 5 6 >> = [1,, -1;, -, 5] = 1-1 - 5 then the following operations are true: >>.* 1 4-3 8-10 30 >>./ 1.0000 1.0000-3.0000.0000 -.5000 1.000 >>.^ 3 1 8-1 8-8 15 6

ENGR 81 MTL 4: rray Operations 6. uilt-in rray Functions MTL has many built-in functions that can be used with arrays. Some of them are ( is a vector): max() min() mean() sum() length() sort() Returns the largest element in Returns the smallest element in Returns the average value of the elements in Returns the sum of the elements of Returns the number of elements in Sorts the elements of The Help window gives information about many other built-in MTL functions. EXMPLES OF UILT IN FUNCTIONS: >> = [8 9 5 14 10] = 8 9 5 14 10 7

ENGR 81 MTL 4: rray Operations >> max() 14 >> min() >> mean() 8 >> sum() 48 >> length() 6 >> sort() 5 8 9 10 14 8

ENGR 81 MTL 4: rray Operations >> mass = [ 4 5 10 0 50]; >> force = [1.5 3. 30 61 6 94]; >> mu = force./ (9.81 * mass) mu = 0.6371 0.591 0.66 0.618 0.591 0.5994 >> mu_ave = mean(mu) meu_ave = 0.6087 9