Thinking Like an Engineer. Instructor Slides

Size: px
Start display at page:

Download "Thinking Like an Engineer. Instructor Slides"

Transcription

1 Instructor Slides Thinking Like an Engineer An Active Learning Approach Stephan, Bowman, Park, Sill, Ohland Third Edition Copyright 2015 Pearson Prentice-Hall, Inc.

2 Create relational expressions using relational operators. Combine relational expressions using logical operators to form logical expressions. Create and use logical variables in decisions. Design logic within the constraints of the priority of operators. Apply selected functions to logical variables (STRCMPI). Predict the number of possible outcomes and the actual result of a conditional statement. Determine if two conditional statements are logically equivalent. Utilize single or nested conditional statement structures with a program (IF/ELSEIF/ELSE).

3 Motivation: Give computers decision making authority. Computers: Can make binary decisions based on binary arguments The only decision a computer can make: TRUE FALSE (or YES- NO or 1-0) MATLAB: Can ask yes/no questions and conditionally execute code based on the outcome of the questions.

4 IF Q1 T IF Q1 Yes F No IF Q1 1 0

5 Single IF Statement 3 parts: Question, True, False = IF (Q, T, F) IF Q T F

6 if o Ask question. The Condition portion can contain o simple Write block relational of code what to do if true expressions or complex expressions built with with instruction on TRUE option combinations of logic and relational operators. else what to do if false o o o Designate the of the operations completed if the logical statement is true. Write block of code with instruction on FALSE option. Designate the of the IF statement.

7 You must test each branch of your algorithm! For each diamond, need TWO test cases. Branch T F IF Q F Test Case If Q is true If Q is false T

8 Greater than Less than Greater than or equal to Equal to Less than or equal to Not equal to

9 if Insert Condition Insert MATLAB Code (True) if Insert Condition Insert MATLAB Code (True) else Insert MATLAB Code (False) X = 5; if X < 10 X = X + 3; M = 20; if M >= 20 else M = 0; M = 1;

10 Ask the user to enter their age in years. If the user enters a negative number, warn the user and use the absolute value. Age = input('enter your age'); if Age < 0 warning('you entered a negative value. Using absolute value.') Age = abs(age);

11 Ask the user to enter circumference of a sphere in units of centimeters. Determine the volume of a sphere in units of liters. If the user enters a negative value for circumference, use an error message to terminate the program. C = input('enter the circumference [cm]'); if C < 0 error('you entered a negative value.') else d = C / pi; r = d / 2; V = 4/3 * pi * r^3

12 We want to take the square root of the sum of two variables, A and B. If the sum of A and B is negative, display a warning message, and calculate the square root of the absolute value; otherwise, calculate the square root of the sum of A and B. A = 5; B = 10; if A + B < 0 warning('error: A+B is negative, use absolute value\n') else Y = sqrt(abs(a+b)); Y = sqrt(a+b);

13 MATLAB converts decimal values to binary numbers. Some decimals up with errors in the 16 th decimal place. In the Command Window, type: x = 1.6 fprintf('%0.16f',x) Result: Note the residual "1" in the 16 th decimal place.

14 In the Command Window, type: x = 1.5; y = 3; if y == (3.2*x)/1.6 fprintf('yes\n') else fprintf('no\n') fprintf('%0.16f\t\t%0.16f',3.2*x/1.6,y) Moral of the Story Be very careful using == as a test for IF. Result: NO

15 IF Q1 T1 F1 IF Q2 T2 F2

16 Single IF Statement 3 parts: Question, True, False Nested IF Statements F1 =IF(Q1,T1,IF(Q2,T2,F2)) = IF (Q, T, F) T IF Q F IF Q1 F1 IF Q2 T1 T2 F2

17 if o Ask Question 1. what to do if Q1 true o Write block of code with instruction on TRUE option. elseif what to do if Q2 true o Ask Question 2. o Write block of code with instruction on TRUE option. else what to do if false o o o Designate the of the operations completed if the logical statement is true. Write block of code with instruction on FALSE option. Designate the of the if statement.

18 You must test each branch of your algorithm! For each diamond, need TWO test cases. Branch T1 F1 T2 F2 Test Case If Q1 is true If Q1 is false If Q2 is true If Q2 is false IF Q1 IF Q2 F1 F2 T1 T2

19 a = 4; b = 2; if a > 3 fprintf('%0.0f ',a) elseif a < 5 fprintf('%0.0f ',b) What values will display in the Command Window? A. 4 2 B. 2 C. 4 C D E. Nothing will display

20 Based on the user choice, save the food name in the text variable food. Assume user does not close window without making a choice. Use if elseif else commands. If the user chooses option #1, their favorite food is pizza; otherwise if the user chooses #2, it is tacos; otherwise if the user chooses #3, it is ice cream; otherwise it is spinach. 4 outcomes = 3 decisions Use if, elseif, elseif, else sequence

21 if food == 1 favorite = 'pizza' elseif food == 2 favorite = 'tacos' elseif food == 3 favorite = 'ice cream' else favorite = 'spinach'

22 Based on the user choice, save the food name in the text variable food. Use if elseif else commands. What happens if user closes window without making a choice?

23 if food == 1 favorite = 'pizza' elseif food == 2 favorite = 'tacos' elseif food == 3 favorite = 'ice cream' elseif food == 4 favorite = 'spinach' else fprintf('you did not make a selection')

24 At one atmosphere of pressure, water changes phases based upon temperature. Temperature [ C] Phase < 0 Solid Liquid > 100 Gas Create an program to determine the phase of water stored as text given the input temperature by the user in degrees Fahrenheit [ F].

25 If the water is at or less than zero Celsius [ C], it is solid; otherwise if the water is 100 degrees Celsius [ C] or greater, it is vapor; otherwise it is a liquid. 3 outcomes = 2 decisions Use if, elseif, else sequence Use the English as a guide. The commas separate the conditions from the actions. The semicolons separate the questions. The period marks the of the statement.

26 if T <= SLlim phase = 'solid' elseif T >= LGlim phase = 'vapor' else phase = 'liquid'

27 At one atmosphere of pressure, water changes phases based upon temperature. Temperature [ C] Phase < 0 Solid Liquid > 100 Gas Create a program to determine the phase of water stored as text given the input temperature by the user in degrees Fahrenheit [ F]. As output, tell the user the temperature entered and the phase. If the user enters a value below the physical possible limit of the temperature scale, inform the user of the mistake and terminate the program.

28 if T <= Tlim error('temperature is not physically possible.') if T <= SLlim phase = 'solid' elseif T >= LGlim phase = 'vapor' else phase = 'liquid'

29 if what to do if Q1 true else if what to do if Q2 true else o Ask Question 1. o o Write block of code with instruction on TRUE option. Designate the of the operations completed if the first logical statement is true. o Ask Question 2. o o Write block of code with instruction on TRUE option. Designate the of the operations completed if the second logical statement is true. what to do if false o Write block of code with instruction on FALSE option. o o Designate the of the second IF statement. Designate the of the second IF statement.

30 IF / ELSEIF IF / ELSE IF a = 4; b = 2; if a > 3 fprintf('%0.0f ',a) elseif a < 5 fprintf('%0.0f ',b) a = 4; b = 2; if a > 3 fprintf('%0.0f ',a) else if a < 5 fprintf('%0.0f ',b)

31 If the Reynolds number of a fluid flowing in a pipe is less than 2,000, the flow is laminar; otherwise, if the Reynolds number is greater than 10,000, the flow is turbulent; otherwise, it is considered transitional flow. Method 1 elseif Method 2 else if if Re < 2000 flow='laminar'; if Re < 2000 flow='laminar'; elseif Re > flow='turbulent'; else flow='transition'; else if Re > flow='turbulent'; else flow='transition';

32 AND Ampersand (&) True if ALL TRUE OR Pipe ( ) False if ALL FALSE NOT Tilde (~) Inverts logic

33

34 z = 3; if (z > 1) (z < 3) fprintf('%0.0f ',z) What will be displayed in the Command Window? A. 1 3 B D C. 1 D. 3 E. Nothing will display.

35 if (m >= 2) && (m < 6) fprintf('%0.0f ',m) What integer values of m will display in the Command Window? A. 2 6 B C C D. Any value will work. E. Nothing will display.

36 if (m >= 2) (m < 6) fprintf('%0.0f ',m) What integer values of m will display in the Command Window? A. 2 6 B D C D. Any value will work. E. Nothing will display.

37 x = 3; y = 5; if (x > 1) && (x < 3) fprintf('%0.0f ',x) else fprintf('%0.0f ',y) What values will display in the Command Window? A. 5 A B. 3 C. 3 5 D. 1 2 E. Nothing will display.

38 if (p > 0) && (p ~= 3) && (p <= 5) fprintf('%0.0f ',p) What integer values of p will display in the Command Window? A B B C D. Any value will work. E. Nothing will display.

39 if (p > 0) (p ~= 3) && (p <= 5) fprintf('%0.0f ',p) What integer values of p will display in the Command Window? A B D C D. Any value will work. E. Nothing will display.

40 Ask the user to enter the number of times they have seen their favorite movie, using an integer between 0 and 5. Store the result in a variable named MovieNumA. If the user enters a value less than zero or greater than 5, issue an error message to the user telling them if their value was too high (greater than 5) or too low (less than zero) and terminate the program.

41 Ask the user to enter temperature and pressure readings from a reactor. If the temperature is greater than zero but less than 100 degrees Celsius [ C] and the pressure is greater than 1 and less than 2 atmospheres [atm], print "Status: Normal Operation" in the Command Window. If the temperature or pressure readings are outside the normal range, print "Status: WARNING! Adjust operating parameters!" in the Command Window.

42 High blood pressure is classified as a pressure reading greater than 140 millimeter of mercury [mm Hg] systolic or 90 millimeter of mercury [mm Hg] diastolic in a middle-aged adult. For young adults, this range is classified as follows: Age Systolic Pressure [mm Hg] Diastolic Pressure [mm Hg] You are developing a blood pressure sensor that will take into account the user's age when making a diagnosis. Assume the user will input their age and pressure readings in millimeters of mercury. Indicate as output if the user has high blood pressure or has normal blood pressure. If the age range entered is not between 15 and 24 years old, indicate the user should not use this method of diagnosis.

Programming in MATLAB Part 2

Programming in MATLAB Part 2 Programming in MATLAB Part 2 A computer program is a sequence of computer commands. In a simple program the commands are executed one after the other in the order they are typed. MATLAB provides several

More information

1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer.

1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer. ENGR 1181 Midterm 2+ Review Note: This practice material does not contain actual test questions or represent the format of the final. The first 20 questions should be completed WITHOUT using MATLAB. This

More information

MATLAB for Chemical engineer

MATLAB for Chemical engineer University of Baghdad College of Engineering Department of Chemical Engineering MATLAB for Chemical engineer Basic and Applications Lecture No. 9 Dr. Mahmood Khazzal Hummadi Samar Kareem 2016 Lecture No.

More information

Branches, Conditional Statements

Branches, Conditional Statements Branches, Conditional Statements Branches, Conditional Statements A conditional statement lets you execute lines of code if some condition is met. There are 3 general forms in MATLAB: if if/else if/elseif/else

More information

The Next Step. Mathematics Applications for Adults. Book Measurement

The Next Step. Mathematics Applications for Adults. Book Measurement The Next Step Mathematics Applications for Adults Book 14019 Measurement OUTLINE Mathematics - Book 14019 Measurement The Metric System use correct metric units to measure length, volume, capacity, mass,

More information

Scope and Sequence for Math 4 (1e)

Scope and Sequence for Math 4 (1e) Number Strand Scope and Sequence for Math 4 (1e) Number Sense and Numeration Counts by 1 s, 2 s, 3 s, 4 s, 5 s, 6 s, 7 s, 8 s, 9 s, 10 s, 12 s, 25 s, 100 s, A s, and F s 6, 10, 25, 28, 29, 32, 68, 99,

More information

Lecture 4 8/24/18. Expressing Procedural Knowledge. Procedural Knowledge. What are we going to cover today? Computational Constructs

Lecture 4 8/24/18. Expressing Procedural Knowledge. Procedural Knowledge. What are we going to cover today? Computational Constructs What are we going to cover today? Lecture 4 Conditionals and Boolean Expressions What is procedural knowledge? Boolean expressions The if-else and if-elif-else statements s Procedural Knowledge We differentiate

More information

Math 98 - Introduction to MATLAB Programming. Fall Lecture 1

Math 98 - Introduction to MATLAB Programming. Fall Lecture 1 Syllabus Instructor: Chris Policastro Class Website: https://math.berkeley.edu/~cpoli/math98/fall2016.html See website for 1 Class Number 2 Oce hours 3 Textbooks 4 Lecture schedule slides programs Syllabus

More information

ROCHESTER COMMUNITY SCHOOL MATHEMATICS SCOPE AND SEQUENCE, K-5 STRAND: NUMERATION

ROCHESTER COMMUNITY SCHOOL MATHEMATICS SCOPE AND SEQUENCE, K-5 STRAND: NUMERATION STRAND: NUMERATION Shows one-to-one correspondence for numbers 1-30 using objects and pictures Uses objects and pictures to show numbers 1 to 30 Counts by 1s to 100 Counts by 10s to 100 Counts backwards

More information

Number Sense. I CAN DO THIS! Third Grade Mathematics Name. Problems or Examples. 1.1 I can count, read, and write whole numbers to 10,000.

Number Sense. I CAN DO THIS! Third Grade Mathematics Name. Problems or Examples. 1.1 I can count, read, and write whole numbers to 10,000. Number Sense 1.1 I can count, read, and write whole numbers to 10,000. 1.2 I can compare and order numbers to 10,000. What is the smallest whole number you can make using the digits 4, 3, 9, and 1? Use

More information

Physics 326G Winter Class 6

Physics 326G Winter Class 6 Physics 36G Winter 008 Class 6 Today we will learn about functions, and also about some basic programming that allows you to control the execution of commands in the programs you write. You have already

More information

6. Control Statements II

6. Control Statements II Visibility Declaration in a block is not visible outside of the block. 6. Control Statements II Visibility, Local Variables, While Statement, Do Statement, Jump Statements main block int main () int i

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

Relational & Logical Operators, Selection Statements

Relational & Logical Operators, Selection Statements Relational & Logical Operators, Selection Statements by Ahmet Sacan selection statements, branching statements, condition, relational expression, Boolean expression, logical expression, relational operators,

More information

350 SMART MANOMETER OPERATING INSTRUCTIONS

350 SMART MANOMETER OPERATING INSTRUCTIONS 99 Washington Street Melrose, MA 02176 Phone 781-665-1400 Toll Free 1-800-517-8431 Visit us at www.testequipmentdepot.com 350 SMART MANOMETER OPERATING INSTRUCTIONS Meriam Instrument s 350 Smart Manometer

More information

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Spring 2014, Prepared by Ali Abu Odeh 1 Table of Contents Fundamentals of Flowcharts 2 3 Flowchart with Conditions Flowchart with

More information

Step by step set of instructions to accomplish a task or solve a problem

Step by step set of instructions to accomplish a task or solve a problem Step by step set of instructions to accomplish a task or solve a problem Algorithm to sum a list of numbers: Start a Sum at 0 For each number in the list: Add the current sum to the next number Make the

More information

Programming Basics and Practice GEDB029 Decision Making, Branching and Looping. Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029

Programming Basics and Practice GEDB029 Decision Making, Branching and Looping. Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029 Programming Basics and Practice GEDB029 Decision Making, Branching and Looping Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029 Decision Making and Branching C language possesses such decision-making capabilities

More information

Lecture 4. Conditionals and Boolean Expressions

Lecture 4. Conditionals and Boolean Expressions Lecture 4 Conditionals and Boolean Expressions What are we going to cover today? What is procedural knowledge? Boolean expressions The if-else and if-elif-else statements Examples Procedural Knowledge

More information

PRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002.

PRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002. PRE-ALGEBRA PREP Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002. Course Description: The students entering prep year have

More information

1.1 The Real Number System

1.1 The Real Number System 1.1 The Real Number System Contents: Number Lines Absolute Value Definition of a Number Real Numbers Natural Numbers Whole Numbers Integers Rational Numbers Decimals as Fractions Repeating Decimals Rewriting

More information

Boolean evaluation and if statements. Making decisions in programs

Boolean evaluation and if statements. Making decisions in programs Boolean evaluation and if statements Making decisions in programs Goals By the end of this lesson you will be able to: Understand Boolean logic values Understand relational operators Understand if and

More information

Name: Partner: Python Activity 9: Looping Structures: FOR Loops

Name: Partner: Python Activity 9: Looping Structures: FOR Loops Name: Partner: Python Activity 9: Looping Structures: FOR Loops Learning Objectives Students will be able to: Content: Explain the difference between while loop and a FOR loop Explain the syntax of a FOR

More information

Variables and Constants

Variables and Constants 87 Chapter 5 Variables and Constants 5.1 Storing Information in the Computer 5.2 Declaring Variables 5.3 Inputting Character Strings 5.4 Mistakes in Programs 5.5 Inputting Numbers 5.6 Inputting Real Numbers

More information

Flow Control. Statements We Will Use in Flow Control. Statements We Will Use in Flow Control Relational Operators

Flow Control. Statements We Will Use in Flow Control. Statements We Will Use in Flow Control Relational Operators Flow Control We can control when how and the number of times calculations are made based on values of input data and/or data calculations in the program. Statements We Will Use in Flow Control for loops

More information

CS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us?

CS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us? 1 CS 105 Lab 3 The purpose of this lab is to practice the techniques of making choices and looping. Before you begin, please be sure that you understand the following concepts that we went over in class:

More information

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm. CHAPTER 1&2 OBJECTIVES After completing this chapter, you will be able to: Understand the basics and Advantages of an algorithm. Analysis various algorithms. Understand a flowchart. Steps involved in designing

More information

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation. Lab 4 Functions Introduction: A function : is a collection of statements that are grouped together to perform an operation. The following is its format: type name ( parameter1, parameter2,...) { statements

More information

Virginia Grade Level Alternative Worksheet

Virginia Grade Level Alternative Worksheet Grade 3 Mathematics Student's Name: Check all that apply: Assigned scores have been entered into the online VGLA System. State Testing Identifier: Assigned scores have been verified and submitted for final

More information

50 Basic Examples for Matlab

50 Basic Examples for Matlab 50 Basic Examples for Matlab v. 2012.3 by HP Huang (typos corrected, 10/2/2012) Supplementary material for MAE384, 502, 578, 598 1 Ex. 1 Write your first Matlab program a = 3; b = 5; c = a+b 8 Part 1.

More information

Prog-PC1: Attaway Chapter 1

Prog-PC1: Attaway Chapter 1 Prog-PC1: Attaway Chapter 1 Name: Student nr: 6. Think about what the results would be for the following expressions and then type them in to verify your answers. >> 25 / 4 * 4 25 >> 3 + 4 ^ 2 1 >> 4 \

More information

A triangle that has three acute angles Example:

A triangle that has three acute angles Example: 1. acute angle : An angle that measures less than a right angle (90 ). 2. acute triangle : A triangle that has three acute angles 3. angle : A figure formed by two rays that meet at a common endpoint 4.

More information

Checking Multiple Conditions

Checking Multiple Conditions Checking Multiple Conditions Conditional code often relies on a value being between two other values Consider these conditions: Free shipping for orders over $25 10 items or less Children ages 3 to 11

More information

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Page 1 6/3/2014 Area and Perimeter of Polygons Area is the number of square units in a flat region. The formulas to

More information

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Page 1 6/3/2014 Area and Perimeter of Polygons Area is the number of square units in a flat region. The formulas to

More information

Concepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++.

Concepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. Concepts Review 1. An algorithm is a sequence of steps to solve a problem. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. 3. A flowchart is the graphical

More information

4. Inputting data or messages to a function is called passing data to the function.

4. Inputting data or messages to a function is called passing data to the function. Test Bank for A First Book of ANSI C 4th Edition by Bronson Link full download test bank: http://testbankcollection.com/download/test-bank-for-a-first-book-of-ansi-c-4th-edition -by-bronson/ Link full

More information

3 Programming. Jalal Kawash Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at:

3 Programming. Jalal Kawash Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at: 3 Programming 1 Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at: http://pages.cpsc.ucalgary.ca/~kawash/peeking/alice-how-to.html JT s resources: www.cpsc.ucalgary.ca/~tamj/203/extras/alice

More information

APPM 2460: Week Three For, While and If s

APPM 2460: Week Three For, While and If s APPM 2460: Week Three For, While and If s 1 Introduction Today we will learn a little more about programming. This time we will learn how to use for loops, while loops and if statements. 2 The For Loop

More information

Fundamentals of Programming Session 4

Fundamentals of Programming Session 4 Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).

More information

Python lab session 1

Python lab session 1 Python lab session 1 Dr Ben Dudson, Department of Physics, University of York 28th January 2011 Python labs Before we can start using Python, first make sure: ˆ You can log into a computer using your username

More information

Tanita Health Ware Help

Tanita Health Ware Help Tanita Health Ware Help Getting Started Managing Users Measurements Analysis Graphs Files & Sharing Exporting ANT Scale Installation Using Garmin Watches Bluetooth Scale Installation Getting Started The

More information

2. The Wheel of Theodorus in Problem 4.1 includes only the first 11 triangles in the wheel. The wheel can go on forever.

2. The Wheel of Theodorus in Problem 4.1 includes only the first 11 triangles in the wheel. The wheel can go on forever. A C E Applications Connections Extensions Applications 1. The hypotenuse of a right triangle is 15 centimeters long. One leg is 9 centimeters long. How long is the other leg? 2. The Wheel of Theodorus

More information

ADW GRADE 3 Math Standards, revised 2017 NUMBER SENSE (NS)

ADW GRADE 3 Math Standards, revised 2017 NUMBER SENSE (NS) NUMBER SENSE (NS) Students understand the relationships among the numbers, quantities and place value in whole numbers up to 1,000. They understand the relationship among whole numbers, simple fractions

More information

Lecture 1: Hello, MATLAB!

Lecture 1: Hello, MATLAB! Lecture 1: Hello, MATLAB! Math 98, Spring 2018 Math 98, Spring 2018 Lecture 1: Hello, MATLAB! 1 / 21 Syllabus Instructor: Eric Hallman Class Website: https://math.berkeley.edu/~ehallman/98-fa18/ Login:!cmfmath98

More information

21-Loops Part 2 text: Chapter ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie

21-Loops Part 2 text: Chapter ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie 21-Loops Part 2 text: Chapter 6.4-6.6 ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie While Loop Infinite Loops Break and Continue Overview Dr. Henry Louie 2 WHILE Loop Used to

More information

Understand the concept of volume M.TE Build solids with unit cubes and state their volumes.

Understand the concept of volume M.TE Build solids with unit cubes and state their volumes. Strand II: Geometry and Measurement Standard 1: Shape and Shape Relationships - Students develop spatial sense, use shape as an analytic and descriptive tool, identify characteristics and define shapes,

More information

Indirect measure the measurement of an object through the known measure of another object.

Indirect measure the measurement of an object through the known measure of another object. Indirect measure the measurement of an object through the known measure of another object. M Inequality a sentence that states one expression is greater than, greater than or equal to, less than, less

More information

Central Valley School District Math Curriculum Map Grade 8. August - September

Central Valley School District Math Curriculum Map Grade 8. August - September August - September Decimals Add, subtract, multiply and/or divide decimals without a calculator (straight computation or word problems) Convert between fractions and decimals ( terminating or repeating

More information

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1 Hands-on Lab 1: LabVIEW NI-DAQ Basics 1 This lab reviews LabVIEW concepts needed towards the course s final objective of position regulation using computer-controlled state feedback. Specific LabVIEW concepts

More information

12 m. 30 m. The Volume of a sphere is 36 cubic units. Find the length of the radius.

12 m. 30 m. The Volume of a sphere is 36 cubic units. Find the length of the radius. NAME DATE PER. REVIEW #18: SPHERES, COMPOSITE FIGURES, & CHANGING DIMENSIONS PART 1: SURFACE AREA & VOLUME OF SPHERES Find the measure(s) indicated. Answers to even numbered problems should be rounded

More information

1. Expand and simplify: 9. Determine the area of the triangle. a. 5 b. 2. Simplify: a. ( 3) c. ( 2) d. 4 ( 2) 3. e ( 3) ( 5)

1. Expand and simplify: 9. Determine the area of the triangle. a. 5 b. 2. Simplify: a. ( 3) c. ( 2) d. 4 ( 2) 3. e ( 3) ( 5) Math 08 Final Exam Review. Expand and simplify: (Section.6). Simplify: ( ) ( ) 00 d. ( ) (Section.,.6,.) (Section.,.,.) 6 ( ) ( ) e. 6 6 8 (Section.,.6,.) (Section.,.) ( 6 ) (Section.,.,.). Translate into

More information

Lesson 1.9 No learning goal mapped to this lesson Compare whole numbers up to 100 and arrange them in numerical. order.

Lesson 1.9 No learning goal mapped to this lesson Compare whole numbers up to 100 and arrange them in numerical. order. Unit 1 Numbers and Routines 1 a D Find values of coin and bill combinations (Lessons 1.2, 1.6) 2.1.3 Identify numbers up to 100 in various combinations of tens and ones. ISTEP+ T1 #9-10 2.2.1 Model addition

More information

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 14 Number/Computation addend Any number being added algorithm A step-by-step method for computing array A picture that shows a number of items arranged in rows and columns to form a rectangle associative

More information

Seventh Grade Mathematics Content Standards and Objectives

Seventh Grade Mathematics Content Standards and Objectives Seventh Grade Mathematics Content Standards and Objectives Standard 1: Number and Operations beyond the field of mathematics, students will M.S.7.1 demonstrate understanding of numbers, ways of representing

More information

7 Control Structures, Logical Statements

7 Control Structures, Logical Statements 7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,

More information

Selections. EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG

Selections. EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG Selections EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG Learning Outcomes The Boolean Data Type if Statement Compound vs. Primitive Statement Common Errors

More information

5th Grade Mathematics Essential Standards

5th Grade Mathematics Essential Standards Standard 1 Number Sense (10-20% of ISTEP/Acuity) Students compute with whole numbers*, decimals, and fractions and understand the relationship among decimals, fractions, and percents. They understand the

More information

LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University

LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University Recap Previous Homework Following Instruction Create a Pressure Conversion VI that takes

More information

Real Numbers Student Activity Sheet 1; use with Overview

Real Numbers Student Activity Sheet 1; use with Overview Real Numbers Student Activity Sheet 1; use with Overview 1. Complete the graphic organizer with examples of each type of number. 2. REINFORCE Give at least three examples of each type of number. Whole

More information

Matlab Examples. (v.01, Fall 2011, prepared by HP Huang)

Matlab Examples. (v.01, Fall 2011, prepared by HP Huang) 1 Matlab Examples (v.01, Fall 2011, prepared by HP Huang) These examples illustrate the uses of the basic commands that will be discussed in the Matlab tutorials. This collection does not reflect the full

More information

Archdiocese of Washington Catholic Schools Academic Standards Mathematics

Archdiocese of Washington Catholic Schools Academic Standards Mathematics 5 th GRADE Archdiocese of Washington Catholic Schools Standard 1 - Number Sense Students compute with whole numbers*, decimals, and fractions and understand the relationship among decimals, fractions,

More information

CSc 372. Comparative Programming Languages. 36 : Scheme Conditional Expressions. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 36 : Scheme Conditional Expressions. Department of Computer Science University of Arizona 1/26 CSc 372 Comparative Programming Languages 36 : Scheme Conditional Expressions Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/26 Comparison

More information

Virginia State Standards Alignments for Mathematics. Providing rigorous mathematics intervention for K-8 learners with unparalleled precision

Virginia State Standards Alignments for Mathematics. Providing rigorous mathematics intervention for K-8 learners with unparalleled precision Virginia State Standards Alignments for Mathematics Providing rigorous mathematics intervention for K-8 learners with unparalleled precision K.1 The student, given two sets, each containing 10 or fewer

More information

7-3 Parallel and Perpendicular Lines

7-3 Parallel and Perpendicular Lines 7-3 Parallel and Perpendicular Lines Interior Angles: Exterior Angles: Corresponding Angles: Vertical Angles: Supplementary Angles: 1 2 3 4 5 6 7 8 Complimentary Angles: 7-3 Parallel and Perpendicular

More information

APS Seventh Grade Math District Benchmark Assessment NM Math Standards Alignment

APS Seventh Grade Math District Benchmark Assessment NM Math Standards Alignment APS Seventh Grade Math District Benchmark NM Math Standards Alignment SEVENTH GRADE NM STANDARDS Strand: NUMBER AND OPERATIONS Standard: Students will understand numerical concepts and mathematical operations.

More information

1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer.

1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer. ENGR 1181 Midterm 2+ Review Note: This practice material does not contain actual test questions or represent the format of the final. The first 20 questions should be completed WITHOUT using MATLAB. This

More information

Estimate A number that is close to an exact answer. An approximate answer.

Estimate A number that is close to an exact answer. An approximate answer. Estimate A number that is close to an exact answer. An approximate answer. Inverse Operations Operations used to undo each other + - X Product The result of multiplying two factors together. 3 x 4=12 Factor

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

Mathcad Lecture #3 In-class Worksheet Functions

Mathcad Lecture #3 In-class Worksheet Functions Mathcad Lecture #3 In-class Worksheet Functions At the end of this lecture, you should be able to: find and use intrinsic Mathcad Functions for fundamental, trigonometric, and if statements construct compound

More information

Selection Statements

Selection Statements Selection Statements by Ahmet Sacan selection statements, branching statements, condition, relational expression, Boolean expression, logical expression, relational operators, logical operators, truth

More information

Performance Level Descriptors. Mathematics

Performance Level Descriptors. Mathematics Performance Level Descriptors Grade 3 Well Students rarely, Understand that our number system is based on combinations of 1s, 10s, and 100s (place value, compare, order, decompose, and combine using addition)

More information

1.1 Introduction. 1.2 Model

1.1 Introduction. 1.2 Model 1 Change of Scales 1.1 Introduction Consider the concept of Temperature. It is used in heat transfer which seeks to understand energy transfer in material bodies as a result of temperature differences.

More information

FOURTH GRADE Mathematics Standards for the Archdiocese of Detroit

FOURTH GRADE Mathematics Standards for the Archdiocese of Detroit FOURTH GRADE Mathematics Standards for the Archdiocese of Detroit *Provide 3 dates for each standard Initial Date(s) Operations and Algebraic Thinking. Use the four operations with whole numbers to solve

More information

Computational Photonics, Summer Term 2012, Abbe School of Photonics, FSU Jena, Prof. Thomas Pertsch

Computational Photonics, Summer Term 2012, Abbe School of Photonics, FSU Jena, Prof. Thomas Pertsch Computational Photonics Seminar 02, 30 April 2012 Programming in MATLAB controlling of a program s flow of execution branching loops loop control several programming tasks 1 Programming task 1 Plot the

More information

Computer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering

Computer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering Computer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering 1 Introduction A computer program is a sequence of computer

More information

Lecture 3 Programming in MATLAB. Dr. Bedir Yousif

Lecture 3 Programming in MATLAB. Dr. Bedir Yousif Lecture 3 Programming in MATLAB Dr. Bedir Yousif RELATIONAL AND LOGICAL OPERATORS Relational operator Description < Less than > Greater than = Greater than or equal to = = Equal

More information

Mechanical Engineering Department Second Year

Mechanical Engineering Department Second Year Lecture 3: Control Statements if Statement It evaluates a logical expression and executes a group of statements when the expression is true. The optional (elseif) and else keywords provide for the execution

More information

Math Content

Math Content 2013-2014 Math Content PATHWAY TO ALGEBRA I Hundreds and Tens Tens and Ones Comparing Whole Numbers Adding and Subtracting 10 and 100 Ten More, Ten Less Adding with Tens and Ones Subtracting with Tens

More information

Chapter 2: Functions and Control Structures

Chapter 2: Functions and Control Structures Chapter 2: Functions and Control Structures TRUE/FALSE 1. A function definition contains the lines of code that make up a function. T PTS: 1 REF: 75 2. Functions are placed within parentheses that follow

More information

Chapter 4 The If Then Statement

Chapter 4 The If Then Statement The If Then Statement Conditional control structure, also called a decision structure Executes a set of statements when a condition is true The condition is a Boolean expression For example, the statement

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

MATLAB Basics 8 conditionals if statements

MATLAB Basics 8 conditionals if statements 1 MATLAB Basics 8 conditionals if statements Anthony Rossiter University of Sheffield For a neat organisation of all videos and resources http://controleducation.group.shef.ac.uk/indexwebbook.html Introduction

More information

Lab 8: Conditional Statements with Multiple Branches (please develop programs individually)

Lab 8: Conditional Statements with Multiple Branches (please develop programs individually) ENGR 128 Computer Lab Lab 8: Conditional Statements with Multiple Branches (please develop programs individually) I. Background: Multiple Branching and the if/if/ structure Many times we need more than

More information

Module 3: New types of data

Module 3: New types of data Module 3: New types of data Readings: Sections 4 and 5 of HtDP. A Racket program applies functions to values to compute new values. These new values may in turn be supplied as arguments to other functions.

More information

Programming Logic and Design Sixth Edition

Programming Logic and Design Sixth Edition Objectives Programming Logic and Design Sixth Edition Chapter 4 Making Decisions In this chapter, you will learn about: Evaluating Boolean expressions to make comparisons The relational comparison operators

More information

North Carolina Standard Course of Study, 2003, grade 8 [NC] PH Course 3 Lesson

North Carolina Standard Course of Study, 2003, grade 8 [NC] PH Course 3 Lesson [NC] North Carolina Standard Course of Study, 2003, grade 8 PH Course 3 Lesson COMPETENCY GOAL 1: The learner will understand and compute with real 1.01 Develop number sense for the real numbers. 1-2,

More information

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth.

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth. Volume of Cylinders As with prisms, the area of the base of a cylinder tells the number of cubic units in one layer. The height tells how many layers there are in the cylinder. The volume V of a cylinder

More information

Using the Best of Both!

Using the Best of Both! Using the Best of Both! A Guide to Using Connected Mathematics 2 with Prentice Hall Mathematics Courses 1, 2, 3 2012, and Algebra Readiness MatBro111707BestOfBothPH10&CMP2.indd 1 6/7/11 11:59 AM Using

More information

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS INTRODUCTION TO PROBLEM SOLVING Introduction to Problem Solving Understanding problems Data processing Writing an algorithm CONTINUE.. Tool

More information

Common grade: ASTM A36..min. 36,000 yield / min. 58,000 tensile. Size Weight (lbs.) Weight (lbs.)

Common grade: ASTM A36..min. 36,000 yield / min. 58,000 tensile. Size Weight (lbs.) Weight (lbs.) Bar Size Angle Common grade: ASTM A36..min. 36,000 yield / min. 58,000 tensile Size Weight (lbs.) Weight (lbs.) A B C per Foot per 20' 1/2 x 1/2 x 1/8 0.38 7.6 5/8 x 5/8 x 1/8 0.48 9.6 3/4 x 3/4 x 1/8

More information

ADW GRADE 5 Math Standards, revised 2017

ADW GRADE 5 Math Standards, revised 2017 NUMBER SENSE (NS) Students compute with whole numbers, decimals and fractions and understand the relationship among decimals, fractions and percents. They understand the relative magnitudes of numbers.

More information

Data Types and the while Statement

Data Types and the while Statement Session 2 Student Name Other Identification Data Types and the while Statement The goals of this laboratory session are to: 1. Introduce three of the primitive data types in C++. 2. Discuss some of the

More information

74 Wyner Math Academy I Spring 2016

74 Wyner Math Academy I Spring 2016 74 Wyner Math Academy I Spring 2016 CHAPTER EIGHT: SPREADSHEETS Review April 18 Test April 25 Spreadsheets are an extremely useful and versatile tool. Some basic knowledge allows many basic tasks to be

More information

Scope and Sequence Mathematics Kindergarten through Twelfth Grade

Scope and Sequence Mathematics Kindergarten through Twelfth Grade Scope and Sequence Mathematics Kindergarten through Twelfth Grade Topic/Subtopic K 1 2 3 4 5 6 7 8 9 10 11 12 WHOLE NUMBER OPERATION Writing numbers using digits Writing numbers - using words Ordering

More information

Motivating Examples (1.1) Selections. Motivating Examples (1.2) Learning Outcomes. EECS1022: Programming for Mobile Computing Winter 2018

Motivating Examples (1.1) Selections. Motivating Examples (1.2) Learning Outcomes. EECS1022: Programming for Mobile Computing Winter 2018 Motivating Examples (1.1) Selections EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG 1 import java.util.scanner; 2 public class ComputeArea { 3 public static void main(string[] args)

More information

Fundamentals of Programming. Lecture 3: Introduction to C Programming

Fundamentals of Programming. Lecture 3: Introduction to C Programming Fundamentals of Programming Lecture 3: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department Outline A Simple C

More information

Dr. Khaled Al-Qawasmi

Dr. Khaled Al-Qawasmi Al-Isra University Faculty of Information Technology Department of CS Programming Mathematics using MATLAB 605351 Dr. Khaled Al-Qawasmi ١ Dr. Kahled Al-Qawasmi 2010-2011 Chapter 3 Selection Statements

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 36 : Scheme Conditional Expressions Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? Overview For this lab, you will use: one or more of the conditional statements explained below scanf()

More information