ENGR132_Class3A_Knutson

# ENGR132_Class3A_Knutson - Welcome to ENGR132 Transforming...

This preview shows pages 1–18. Sign up to view the full content.

Click to edit Master subtitle style ENGR132 Transforming Ideas to Innovation II Section 006 & 021 Prof. Amanda Knutson and GTA Ben Ahn Class 3a Welcome to

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 Announcement Exam 1: Monday Feb 14th 8:00 – 9:00 pm Elliot Hall No make up exams will be given (DON’T MISS IT!) Worth 15% of your final grade – no adjustments!! Conflicts/accommodations see Chell Nyquist 22
4/24/11 Use logical, relational and conditional operators Draw and interpret flow charts that include different kinds of decision-making structures Describe and solve 2 types of problems using conditional statements Identify a region within a graph Check the validity of inputs 33 Learning Objectives for Today (Text, pg 589 -598)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 Logic statements have 2 conditions True – represented as 1 in Matlab False – represented as 0 in Matlab AND (&) True if and only if all are true OR (|) True if any is true Exclusive OR (xor) True if and only if one is true NOT (~) 44 Logical Operators
4/24/11 A can be true or false B can be true or false AND command: A & B Truth Table A B A&B 1 1 1 1 0 0 0 1 0 0 0 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 A can be true or false B can be true or false OR command: A | B Truth Table A B A|B 1 1 1 1 0 1 0 1 1 0 0 0
4/24/11 XOR = “exclusive or” A can be true or false B can be true or false XOR command: xor(A,B) Truth Table A B xor(A,B) 1 1 0 1 0 1 0 1 1 0 0 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 NOT command reverses other results A can be true or false B can be true or false NOT command: ~(A | B) Truth Table A B A|B ~(A|B) 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 1
4/24/11 < Less than > Greater than <= Less than or equal to >= Greater than or equal to ~= Not Equal to == Equal to * * Not single = because single = is to assign 99 Relational Operators in Matlab

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 Given: a = 2, b = 3, c = 5, d = 3 (a == b) 0 (b == d) 1 (a > b) 0 (a+b == c) 1 (b < c) 1 (b <= c) 1 1010 Example
4/24/11 Given: U = [ 1 3 –2 5 ], V = [ 1 2 –5 4 ], W = [ 1 3 –2 5 ] (U<3) [ 1 0 1 0 ] (U<=(2*V)) [ 1 1 0 1 ] (U==V) [ 1 0 0 0 ] (U>V) [ 0 1 1 1 ] 1111 Example

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 Compound Statements 1212 Given: a = 2, b = 3, c = 5, d = 3 (a < b) & (b < c) 1 & 1 = 1 (a < b) | (c < d) 1 | 0 = 1 ((c == b+a) & (b*d > 9)) | ((~(b >= d)) | (b*d < a*c)) ( 1 & 0) | (~(1) | 1) = ( 0 | 1 ) = 1 (a <= c <= d) ( 2 <= 5 ) <= 3 ± 1 <= 3 1 Matlab evaluates one statement at a time, from left to right
4/24/11 1313 Application: Determine the phase based on composition and

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 1414 Application: Determine the phase for high B composition and high
4/24/11 1515 Determine the phase for mid B composition and high temperature

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/24/11 1616 Determine the phase for mid B composition and low temperature
4/24/11 Objective: Determine the phase based on composition and temperature Inputs: Composition (% B) and temperature

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## ENGR132_Class3A_Knutson - Welcome to ENGR132 Transforming...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online