Array Operations ENGR 1181 MATLAB 4. Aerospace Engineers use turbulence data to calculate how close other planes can fly near the wake of a larger plane.

Slides:



Advertisements
Similar presentations
Lesson 9.5: Factoring Difference of Squares, page 500
Advertisements

Multiplication X 1 1 x 1 = 1 2 x 1 = 2 3 x 1 = 3 4 x 1 = 4 5 x 1 = 5 6 x 1 = 6 7 x 1 = 7 8 x 1 = 8 9 x 1 = 9 10 x 1 = x 1 = x 1 = 12 X 2 1.
Division ÷ 1 1 ÷ 1 = 1 2 ÷ 1 = 2 3 ÷ 1 = 3 4 ÷ 1 = 4 5 ÷ 1 = 5 6 ÷ 1 = 6 7 ÷ 1 = 7 8 ÷ 1 = 8 9 ÷ 1 = 9 10 ÷ 1 = ÷ 1 = ÷ 1 = 12 ÷ 2 2 ÷ 2 =
Math Expressions How does it all work together…?.
Fraction XII Subtracting Unlike Denominators
Fraction IX Least Common Multiple Least Common Denominator
5-4 Completing the Square Warm Up Lesson Presentation Lesson Quiz
Partial Products for Multiplication
L.O.1 To be able to recall multiplication and division facts involving the 2,3,4,6,7 and 8 times tables.
Answer these on your whiteboards:
Year 5 Term 3 Unit 6b Day 1.
Click here Can you work out the answer? 20 ÷ 4 =
Who Wants To Be A Millionaire? Decimal Edition Question 1.
£1 Million £500,000 £250,000 £125,000 £64,000 £32,000 £16,000 £8,000 £4,000 £2,000 £1,000 £500 £300 £200 £100 Welcome.
-seminar 1 for digital signal processing
HOW TO COMPARE FRACTIONS
Order of Operations ( ) + X The Order of Operations tells us how to do a math problem with more than one operation, in the correct order.
Objective - To simplify expressions using the order of operations. Simplify each expression below. 1) 6 + 5(8 - 2) 2) 3) 4)
ORDER OF OPERATIONS LESSON 2 DAY 2. BEDMAS B – Brackets E – Exponents D – Division from left to right M – Multiply from left to right A – Add from left.
Objective The student will be able to:
Algebra I 1.2 Order of Operations.
Math 110 online work that is due today at the start of class:
$100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400.
Order of Operations Lesson
Lesson 2: Perfect Squares and Cubes, Square and Cube Roots
© Richard A. Medeiros 2004 x y Function Machine Function Machine next.
DIVISIBILITY, FACTORS & MULTIPLES
5-3 Solving Quadratic Equations by Graphing and Factoring Warm Up
Least Common Multiple LCM 2 Methods
Data handling Thursday. Objectives for today Extending our knowledge of statistics – range, mode, median and the mean. mode rangeToday we are focusing.
Created by Susan Neal $100 Fractions Addition Fractions Subtraction Fractions Multiplication Fractions Division General $200 $300 $400 $500 $100 $200.
Fraction XI Adding Mixed Numbers With Unlike Denominators
Chapter 1: Expressions, Equations, & Inequalities
Fraction IX Least Common Multiple Least Common Denominator
Ch. 1: Number Relationships
The Distributive Property. The distributive property is mental math strategy that can be used when multiplying. 43 x 5 =?
Least Common Multiples and Greatest Common Factors
We can multiply bigger numbers using an algorithm!
Do Now 1/13/10 Take out HW from last night. Take out HW from last night.  Text p. 222, #20-60 evens Copy HW in your planner. Copy HW in your planner.
Solving Systems of Linear Equations By Elimination
12-2 Conditional Probability Obj: To be able to find conditional probabilities and use formulas and tree diagrams.
Math 7A: Monday, Sept. 12, 2011 Test Alert: Unit 1 Test on Friday!
Algebra I B. MacDonald.  What is a GCF? What is a GCF?  Factoring out a GCF Factoring out a GCF.
Using Lowest Common Denominator to add and subtract fractions
One step equations Add Subtract Multiply Divide Addition X + 5 = -9 X = X = X = X = X = 2.
Intro to Price index.
Let’s Do Algebra Tiles Algebra Tiles Manipulatives used to enhance student understanding of subject traditionally taught at symbolic level. Provide access.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Functions in MatLab Create a new folder on your Z:drive called MatLab_Class24 Start MatLab and change your current directory to MatLab_Class24 Topics:
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.
Input and Output ENGR 1181 MATLAB 5. Input and Output In The Real World Script files (which provide outputs given inputs) are important tools in MATLAB.
Array Math.
For Loops 2 ENGR 1181 MATLAB 9. For Loops and Looped Programming in Real Life As first introduced last lecture, looping within programs has long been.
Functions 1 ENGR 1181 MATLAB 14.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
For Loops 1 ENGR 1181 MATLAB 8. For Loops and Looped Programming in Real Life Looping within programs has long been a useful tool for completing mundane.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Array Creation ENGR 1181 MATLAB 2. Civil engineers store seismic data in arrays to analyze plate tectonics as well as fault patterns. These sets of data.
Array Operations ENGR 1181 MATLAB 4.
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
Array Accessing and Strings ENGR 1187 MATLAB 3. Today's Topics  Array Addressing (indexing)  Vector Addressing (indexing)  Matrix Addressing (indexing)
DIVISIBILITY RULES LESSON 3. Dividing by 2 All even numbers are divisible by 2. Example: all numbers ending in 0,2,4,6 or 8.
Logical Expressions ENGR 1181 MATLAB 6. Logical Expressions in Real Life Sorting objects in manufacturing processes can be accomplished automatically.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
Presentation transcript:

Array Operations ENGR 1181 MATLAB 4

Aerospace Engineers use turbulence data to calculate how close other planes can fly near the wake of a larger plane. These vortices can cause unstable flight conditions for smaller planes approaching the wake of a commercial jetliner. Thus this turbulent flow data is important in airspace management. Array Operations In The Real World

Today's Learning Objectives  After today’s class, students will be able to: Explain meaning of element-by-element operations. Identify situations where the standard operators in MATLAB (when used with arrays) are reserved for linear algebra, which is not always element-by- element. Apply dot operators for the six cases where linear algebra is not element-by-element and therefore dot operators are needed to produce element-by- element calculations.

Scalar Math Review For scalar variables a and b: >> a = 6; >> b = 2; MATLAB has scalar math operations: >> a + b >> a – b >> a * b >> a / b >> a ^ b

Scalar–Vector Addition Define the vector v and the scalar c: >> v = [ ] ; >> c = 4 ; Add them: >> v + c >> c + v ans =

Vector–Vector Addition Define the vector v and the vector c: >> v = [ ] ; >> c = [ ] ; Add them: >> v + c >> c + v ans = v and c must be the same length!

Scalar - Vector Multiplication For the vector x and the scalar c: >> v = [ ] ; >> c = 4 ; Multiply them: >> c * v >> v * c ans =

Vector - Vector Multiplication x = [ ] y = [ ] Now multiply: >> z = x * y ??? Error using ==> mtimes Inner matrix dimensions must agree!!!

Vector - Vector Multiplication x = [ ] y = [ ] To multiply to arrays element by element we need to use the following syntax: >> z = x.* y z =

Scalar - Vector Division >> v = [ ] >> c = 4 Divide them: >> v / c ans =

Scalar - Vector Division >> v = [ ] >> c = 4 Divide them: >> c / v Error using / Matrix dimensions must agree. >> c./v ans =

Vector - Vector Division x = [ ] y = [ ] Divide them: >> x. / y ans = Also, try >> y. / x ans =

Scalar - Vector Exponents >> v = [ ] >> c = 4 Try: >> v ^ c Try instead: >> v.^ c Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead.

Vector - Vector Exponents x = [ ] ; y = [ ] ; Try this: >> x.^ y Also try >> y.^ x ans = ans =

Scalar - Vector Math Summary For a scalar c and a vector v: Addition v + corc + v Subtractionv – corc – v Multiplicationv * corc * v orv.*corc.*v Divisionv / cor c./v orv./ c Exponentv.^ c or c.^ v

Vector - Vector Math Summary For two vectors x and y : Addition x + yory + x Subtractionx – yory – x Multiplicationx.* yory.* x Divisionx./ yory./ x Exponentx.^ y or y.^ x You must always use the dot operator for Multiplication, Division, and Exponent

Example 1 Calculate y = 4x 2 for x = 1,2,3 and 4. First define x >> x = [ ]; Then calculate y >> y = 4.*x.^2 Which ‘.’ is required here? y =

Example 2 Calculate y = (4a 2 + a)/(2+a) for a = 1,2,3 and 4. First define a = [ ] >> a = [ ]; a = >> y = ((4*a.^2)+a)./(2+a) y =

Built - In Vector Functions MATLAB has built-in functions for vectors When v is a vector: max(v)Returns the largest element in v min(v)Returns the smallest element in v mean(v)Returns the average value of the elements in v sum(v)Returns the sum of the elements of v length(v)Returns the number of elements in v sort(v)Sorts the elements of v

Important Takeaways  Know when to use a dot operator for Multiplication, Division, and Exponents.  Only use a dot operator when appropriate and understand what you are trying to accomplish before you use it.  Vector functions operate on an entire set of numbers located inside of an array, or matrix.

Preview of Next Class  Input and Output Inputting data into and out of programs GPA calculator example  With and without use of vectors Inputting to a script file Output to command window

 Review today’s Quiz #04  Open the in-class activity from the EEIC website and we will go through it together.  Then, start working on MAT-04 homework.  Before next class, you will read more detail about script files including global variables. There is also information on input and output (I/O) commands in MATLAB. What’s Next?