Chapter 1 Computing Tools Data Representation, Accuracy and Precision Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.

Slides:



Advertisements
Similar presentations
Using MatLab and Excel to Solve Building Energy Simulation Problems Jordan Clark
Advertisements

Chapter 05 Solving for the Unknown: A How-To Approach for Solving Equations McGraw-Hill/Irwin Copyright © 2011 by the McGraw-Hill Companies, Inc. All rights.
Chapter Four SOLVING FOR THE UNKNOWN Copyright © 2014 by The McGraw-Hill Companies, Inc. All rights reserved.McGraw-Hill/Irwin.
Flow Charts, Loop Structures
Section 1: Significant Figures
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
Linear Simultaneous Equations
Matrix Mathematics in MATLAB and Excel
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Solving for the Unknown: A How-To Approach for Solving Equations
Chapter 9 Numerical Integration Numerical Integration Application: Normal Distributions Copyright © The McGraw-Hill Companies, Inc. Permission required.
Non-Linear Simultaneous Equations
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Linear Algebraic Equations ~ Gauss Elimination Chapter.
Fortran- Subprograms Chapters 6, 7 in your Fortran book.
Mathcad Variable Names A string of characters (including numbers and some “special” characters (e.g. #, %, _, and a few more) Cannot start with a number.
Copyright © Cengage Learning. All rights reserved. 0 Precalculus Review.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Chapter 10 Review: Matrix Algebra
Chapter 1 Units and Problem Solving
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
Chapter 3 Scientific Measurement 3.1 Using and Expressing Measurements
Chapter 6 Finding the Roots of Equations
Lesson Starter Look at the specifications for electronic balances. How do the instruments vary in precision? Discuss using a beaker to measure volume versus.
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Significant Figures. Exact Numbers Some numbers are exact because they are known with complete certainty. Most exact numbers are integers: exactly 12.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Variables Tutorial 3c variable A variable is any symbol that can be replaced with a number to solve a math problem. An open sentence has at least one.
1 1.7 © 2016 Pearson Education, Inc. Linear Equations in Linear Algebra LINEAR INDEPENDENCE.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 2.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Essentials of College Physics --Serway/Vuille
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
3.1 Using and Expressing Measurements > 1 Copyright © Pearson Education, Inc., or its affiliates. All Rights Reserved. Chapter 3 Scientific Measurement.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 9 Linear Systems of Equations: Gauss Elimination.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Working with Arrays in MATLAB
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
Newton’s Method, Root Finding with MATLAB and Excel
Chapter 1 Introduction. Theories and Experiments The goal of physics is to develop theories based on experiments A theory is a “guess,” expressed mathematically,
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Matlab for Engineers Matlab Environment Chapter 2.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
CHAPTER OUTLINE 3 Solving Equations Slide 2 Copyright (c) The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3.1Simplifying.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
McGraw-Hill/Irwin ©2011 The McGraw-Hill Companies, All Rights Reserved Chapter 5 Solving for the Unknown: A How-to Approach for Solving Equations.
Chapter 2 © Houghton Mifflin Harcourt Publishing Company Accuracy and Precision Accuracy refers to the closeness of measurements to the correct or accepted.
To add, subtract, multiply, and divide, absolutely follow the mathematical rules. 1. All the rules 2. The element-per-element operator 3. Ex1: graphing.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 8 Linear Algebraic Equations and Matrices.
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
3.1 Using and Expressing Measurements > 1 Copyright © Pearson Education, Inc., or its affiliates. All Rights Reserved. Chapter 3 Scientific Measurement.
Chapter 1 Computing Tools Variables, Scalars, and Arrays Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
SIGNIFICANT FIGURES Fun With Numbers!!. SIGNIFICANT FIGURES Significant figures are all numbers in a measurement that show the level of accuracy to which.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
3.1 Using and Expressing Measurements > 1 Copyright © Pearson Education, Inc., or its affiliates. All Rights Reserved. Chapter 3 Scientific Measurement.
ECE 1304 Introduction to Electrical and Computer Engineering
Chapter 7 Matrix Mathematics
Accuracy and Precision
Chapter 4 MATLAB Programming
Solving for the Unknown: A How-to Approach for Solving Equations
One step equation with Multiplication and Division
Chapter 1 Units and Problem Solving
Working with Arrays in MATLAB
Presentation transcript:

Chapter 1 Computing Tools Data Representation, Accuracy and Precision Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Independent and Dependent Variables Independent Variable: Value is free to take on any assigned value Dependent Variable: Value is determined based on the value(s) of the independent variable(s) What are the independent and dependent variables here? Engineering Computation: An Introduction Using MATLAB and Excel

Independent and Dependent Variables (cont.) We usually assume that variables on the left side of the equal sign are dependent, and variables on the right side are independent However, we can rearrange the variables so that they switch sides: To determine whether the variables are dependent or independent, we must consider the problem statement Engineering Computation: An Introduction Using MATLAB and Excel

Independent and Dependent Variables (cont.) Let’s consider the equation for the height of the cannon ball: When we first looked at this problem, we set g, v, and θ to be constant values We varied time, and calculated height for each time value Therefore, t was the independent variable and h was the dependent variable Engineering Computation: An Introduction Using MATLAB and Excel

Functions A function is a mathematical operation that returns a single value for a given input value or set of values In our example, we can calculate a single value of height for each value of time that we choose Therefore, we say that height is a function of time We often show this by including the independent variable(s) in parentheses after the function name: Engineering Computation: An Introduction Using MATLAB and Excel

Functions (cont.) In our in-class exercise, we were asked to find the angle θ that maximized the distance traveled x To solve this problem, we considered x to be a function of time and launch angle: Engineering Computation: An Introduction Using MATLAB and Excel

Scalars and Arrays A scalar is a single value that can be represented on a numerical scale In our cannon example, we calculated a value of height for each value of time In a spreadsheet, each cell is contains a scalar value. This is an advantage of spreadsheets; the storage of results is automatic Engineering Computation: An Introduction Using MATLAB and Excel

Scalars and Arrays (cont.) In a spreadsheet, we do not need to name every variable: the cell address (row/column) defines the storage location In MATLAB and other programming languages, the variables must be named and storage of results must be planned Example: In the cannon problem, we can call time “t”. If t is a scalar, then the value of t is overwritten every time we complete a calculation loop Engineering Computation: An Introduction Using MATLAB and Excel

Scalars and Arrays (cont.) If t is a scalar, then the intermediate results will be lost, and we cannot examine or plot these results when the algorithm is complete However, if t is an array, then these results will be stored An array is a variable that has multiple values An array’s name is followed by an index (or indices, for multi-dimensional arrays) in parentheses Engineering Computation: An Introduction Using MATLAB and Excel

Indices of Arrays Think of the index value as an address For example, suppose that we store values for time at 0.1 second intervals. If we say that t(5) = 0.4, then we mean that the 5 th value in the array of time values is equal to 0.4 Important: Indices must be positive integers, and must start with one Engineering Computation: An Introduction Using MATLAB and Excel

Common Mistakes Using Indices with MATLAB Using an index of zero: Using an index not an integer: setting t(0.1) equal to a value results in the same error as above Engineering Computation: An Introduction Using MATLAB and Excel

Common Mistakes Using Indices with MATLAB Progressing indices by values other than 1. For example, if we take a temperature reading every 10 seconds, and set the first value as T(10), then zeros are filled in for the first nine values of T: (No error is reported, but this result is probably not what is desired) All of these errors result from confusion between independent variables and indices. Thinking of indices as addresses helps avoid these errors Engineering Computation: An Introduction Using MATLAB and Excel

Multi-Dimensional Arrays A variable may have more than one index. A two- dimensional array is similar to the data storage of a spreadsheet. Instead of a row number and a column letter, a two-dimensional array has two index numbers Examples: t(1,5) R(3,3) temp(1,20) Efficient way to store data: if both indices range from 1-10, then the number of values stored is 10 X 10 = 100 Engineering Computation: An Introduction Using MATLAB and Excel

Matrices One- and two-dimensional arrays are also called matrices Many mathematical operations can be performed with matrices - the name MATLAB comes from “Matrix Laboratory” The size of a matrix is defined by the numbers of rows and columns. Example; a 3 X 2 matrix: Engineering Computation: An Introduction Using MATLAB and Excel

Vectors One-dimensional matrices are referred to in MATLAB as “vectors” Vectors can be classified as “column vectors” (all values arranged in a single column) or “row vectors” (all values arranged in a single row) Caution: in mechanics classes, the term “vector” has a different definition: a vector is defined as a physical quantity which is defined by magnitude and direction Engineering Computation: An Introduction Using MATLAB and Excel

Accuracy and Precision Accuracy and precision are often used interchangeably, but have different definitions: Accuracy is a measure of how close our answer is to the actual result. In the cannon example, the assumptions made in the mathematical model affect the accuracy of the results Precision is a measure of the exactness of our calculations – important that we remember that our answer can be no more precise than our input values or of intermediate calculation results Engineering Computation: An Introduction Using MATLAB and Excel

Significant Digits In experimental work, where the precision of all of the input values is known, calculation rules involving the number of significant digits are followed For quantities with decimal points, the number of significant digits is defined as the number of digits between the first non-zero digit and the last digit. Examples: significant digits significant digits significant digits significant digits Engineering Computation: An Introduction Using MATLAB and Excel

How Many Significant Digits? X Can’t tell Engineering Computation: An Introduction Using MATLAB and Excel

Rules for Working with Significant Digits Addition and Subtraction: the number of digits to the right of the decimal point in the answer must be equal to the least number of digits to the right of any of the inputs. Examples: = – = 10.0 Multiplication and Division: the number of significant digits in the answer must equal the least number of significant digits of the input values. Examples: X 5.52 = / = 0.90 Engineering Computation: An Introduction Using MATLAB and Excel

Engineering Calculations In engineering problems, the precision of the input values is usually unknown Example: In the cannon problem, the precisions of the values of 35 degrees and 10 m/s are not given Good rule of thumb: report results to 3 significant digits (some texts recommend 4 significant digits if the first significant digit is a “1”) Remember that for the final answer to be precise to this number of digits, intermediate calculations should be carried out to more digits Engineering Computation: An Introduction Using MATLAB and Excel

Reporting Answers Never report your answer to a ridiculous number of digits! If would sound wrong is you said it verbally; it is equally wrong if you report it in writing Engineering Computation: An Introduction Using MATLAB and Excel The answer is centimeters The answer is centimeters FOUL! Excessive Use of digits

Reporting Answers The computer performs calculations to a large number of digits, but that doesn’t mean the answer is that precise How many digits do Excel and MATLAB carry through in calculations? Approximately 15 for most operations Engineering Computation: An Introduction Using MATLAB and Excel