Logical Expressions ENGR 1181 MATLAB 6. Logical Expressions in Real Life Sorting objects in manufacturing processes can be accomplished automatically.

Slides:



Advertisements
Similar presentations
7.1Variable Notation.
Advertisements

Exponents, Parentheses, and the Order of Operations.
Lesson 1-5 Solving Inequalities September Objective:
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.
Program Design ENGR 1181 MATLAB 11. MATLAB Program Design in Real Life Complex manufacturing processes require careful logic mapping to determine what.
4-2 Improper Fractions and mixed numbers
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Fall 2006AE6382 Design Computing1 Relational and Logical Operators Use relational operators to test two values Work with values of true and false Compare.
Solving Linear Equations
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Warm-Up Review for quiz
Chapter 3 Math Vocabulary
Preview Warm Up California Standards Lesson Presentation.
Step 1: Simplify Both Sides, if possible Distribute Combine like terms Step 2: Move the variable to one side Add or Subtract Like Term Step 3: Solve for.
3.1 EXPONENTS. LESSON 3.1 RECALL 5 3 = 5 x 5 x 5 = 125 Write the Base (5) Write the Base the number of time as the Power ( 3 ) Multiply the numbers together.
Sections 1.4 and 1.5 Order of Operations, Part 1
Spreadsheets Objective 6.02
2 Explain advanced spreadsheet concepts and functions Advanced Calculations 1 Sabbir Saleh_Lecture_17_Computer Application_BBA.
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.
2440: 211 Interactive Web Programming Expressions & Operators.
Bell Ringer = – 5 = = ÷ -2 = =6. -7 – (-7) = After you have completed the bell ringer, take out your homework!
ENG 1181 College of Engineering Engineering Education Innovation Center MAT – Conditional Statements Topics: 1.Conditional statements if-end if-else-end.
Conditional Statements ENGR 1187 MATLAB 7. Conditional Statements in Real Life A Fluorescence Activated Cell Sorter (FACS) sorts cells based on predetermined.
7.2-3 Solving Linear Equations. A linear equation in one variable is an equation in which the same letter is used in all variable terms and the exponent.
Order of Operations.
Equation Jeopardy Add Mixed Multiply/ Divide Fractions Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final Jeopardy Subtract.
To solve an equation with variables on both sides, use inverse operations to "collect" variable terms on one side of the equation. Helpful Hint Equations.
Math 021.  An equation is defined as two algebraic expressions separated by an = sign.  The solution to an equation is a number that when substituted.
Notes October 8, 2012 Unit 3 Linear Expressions and Equations Expressions Linear Expressions and Equations.
Evaluating a Variable Expression To evaluate a variable expression:
Operators Precedence - Operators with the highest precedence will be executed first. Page 54 of the book and Appendix B list C's operator precedence. Parenthesis.
Preview Warm Up California Standards Lesson Presentation.
I CAN use the order of operations to perform arithmetic operations, including those involving whole number exponents.
Divide. Evaluate power – 3 = – 3 EXAMPLE – 3 = 3 2 – – 3 = 6 – 3 Multiply. Evaluate expressions Multiply and divide from.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1-2 Order of Operations and Evaluating Expressions.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
Array Operations ENGR 1181 MATLAB 4.
Doing math In java.
Sec. 1-5 Day 1 HW pg (16-26 even, 33-36). An identity is an equation that is true for all values of the variable. An equation that is an identity.
Operators.
Objectives The student will be able to: 1. multiply monomials. 2. simplify expressions with monomials. SOL: A.2a Designed by Skip Tyler, Varina High School.
1 CS161 Introduction to Computer Science Topic #6.
Array Accessing and Strings ENGR 1187 MATLAB 3. Today's Topics  Array Addressing (indexing)  Vector Addressing (indexing)  Matrix Addressing (indexing)
CONFIDENTIAL 1 Grade 8 Pre-Algebra Solving Equations with Variables on Both Sides.
Operators A binary operator combines two values to get one result: x OP y where OP is any binary operators such as +, -, *, /, ==, !=, >, &&, or even =.
1.7 Intro to Solving Equations Objective(s): 1.) to determine whether an equation is true, false, or open 2.)to find solutions sets of an equation 3.)to.
1-2 Order of Operations Objective: Use the order of operations to evaluate expressions.
Write, Interpret and Use Mathematical Expression and Equations.
WARM UP Page 9 “Check Skills You’ll Need” # 1 – 12.
Copyright 2013, 2010, 2007, 2005, Pearson, Education, Inc.
Assignment statement:
Preview Warm Up California Standards Lesson Presentation.
10 Real Numbers, Equations, and Inequalities.
Accentuate the Negative
Exponents & Scientific Notation Test Corrections
You will need to supply your own calculators for this course---you will need either a TI-82 or a TI-84 graphing calculator.
Math unit 1 review.
MATLAB Logical Expressions
TO MULTIPLY POWERS HAVING THE SAME BASE
Solving Equations with Variables on Both Sides 1-5
Solving Equations with Variables on Both Sides 1-5
Algebra 1 09/21/16 EQ: How do I solve equations with variables on both sides? HW: Due Friday pg. 95 # 1-33 all Bring textbooks tomorrow Quiz on Friday.
Objectives You will be able to:
I can USE THE ORDER OF OPERATIONS USE GROUPING SYMBOLS.
43 Order of Operations  ( ) + - X.
Preview Warm Up California Standards Lesson Presentation.
5.03 Apply operators and Boolean expressions
Preview Warm Up California Standards Lesson Presentation.
Presentation transcript:

Logical Expressions ENGR 1181 MATLAB 6

Logical Expressions in Real Life Sorting objects in manufacturing processes can be accomplished automatically with sorting algorithms developed with logical expressions. Different types of plastics must be sorted by conveyers with logical expressions to properly melt the plastics separately.

Today's Learning Objectives  After today’s class, students will be able to: Apply logical operations correctly in arrays. Analyze data using logical operators.

Evaluating to True / False  In MATLAB, and programming in general: 1 = Logical True 0 = Logical False  MATLAB can evaluate mathematical statements and report the result as true or false, or as 1 or 0

Evaluating to True / False  Any non-zero number will evaluate to TRUE (1)  Zero will evaluate to FALSE (0)  For example: 8 would evaluate to TRUE (1)

MATLAB Relational Operators Recall that relational operators compare two numbers in a comparison statement. Greater than >=Greater than or equal to ==Equal to ~=Not equal to

Evaluating Relational Operators  When we have MATLAB evaluate statements with relational operators, it's like we're giving MATLAB a true-false test. >> 5 > 8 ans = 0  The answer is 0 because this statement is false.

Evaluating Relational Operators >> 10 > 3 ans = 1 >> 10 < 3 ans = 0 >> x= 10 > 3 x = 1 >> x= 10 < 3 x = 0

Logical Operators  Logical operators compare two or more operands (numbers) to see if that combination is true or false.  Result is assigned as true or false.

Logical Operators SymbolNameMeaning &ANDTrue if both are true. |ORTrue if either OR both are true. ~NOTTrue if the operand is false. (Tricky!)

Logical Operator Examples  A & BTrue when both A and B are true  A | BTrue if either A or B is true  ~ ATrue if A is false

Logical Operator Examples  5 & 9  5 & 0  4 | 6  4 | 0  ~ 8  ~ 0 1: TRUE! 5 and 9 are both 'true'. 0: FALSE! 0 is false, so the whole thing is false. 1: TRUE! Either 4 or 6 is true. 1: TRUE! 4 is true, and we just need one 'true'. 0: FALSE! 8 is true, so the answer is false. 1: TRUE! 0 is false, so the answer is true.

MATLAB Order of Precedence 1.Parentheses( ) 2.Exponent^ 3.Logical 'NOT'~ 4.Multiply, Divide* / 5.Add, Subtract+ - 6.Relational Operators = == ~= 7.Logical 'AND'& 8.Logical 'OR|

MATLAB Example >> Y = 6 < == 20/2 Y = 0 Y is FALSE. … Why is Y = 0, or false? Y = 6 < == 10 Y = 6 < 20 == 10 Y = 1 == 10 Y = 0

MATLAB Example Let's add some parentheses and see what happens: >> X= (6<10) + (10 == 20/2) X= 2 … Why is X = 2? X= (6<10) + (10 == 20/2) X = X = 2 In the second step, both pieces of the equation have evaluated to 1. There are no relational or logical operators left, so we just do math!

Important Takeaways  Logical expressions are evaluated as true (1) or false (0) in MATLAB.  All nonzero numbers evaluate to true.  Like arithmetic operations, logical operators have an order of precedence  Logical operators can be combined within arithmetic expressions

Preview of Next Class  Conditional Statements Very important topic! If-end if-else-end if-elseif-else-end Structured examples with flow charts

What’s Next?  Review today’s Quiz #06  Open the in-class activity from the EEIC website and we will go through it together.  Then, start working on MAT-06 homework.  Prepare for next class by reading about conditional statements.