spreadsheet tools for engineers using excel cive 1331 fall 2008 hanadi rifai

55
Spreadsheet Tools for Spreadsheet Tools for Engineers Engineers Using Excel Using Excel CIVE 1331 Fall 2008 Hanadi Rifai

Upload: abraham-shelton

Post on 25-Dec-2015

221 views

Category:

Documents


2 download

TRANSCRIPT

Spreadsheet Tools for EngineersSpreadsheet Tools for EngineersUsing ExcelUsing Excel

CIVE 1331

Fall 2008

Hanadi Rifai

Chapter 1. Engineering Analysis Chapter 1. Engineering Analysis and Spreadsheetsand Spreadsheets

Engineering Analysis and Engineering Analysis and SpreadsheetsSpreadsheets Engineering analysis is a systematic

process for analyzing and understanding problems that arise in the various field of engineering

To carry out this process, we use problem solving techniques

Spreadsheet programs can be used to solve the problem once you have defined it and set it up properly

Spreadsheets allow you to:Spreadsheets allow you to:

Import, export, store, process, and sort data

Display data graphically Analyze data statistically Fit algebraic equations through datasets Solve single and simultaneous algebraic

equations Solve optimization problems

ExamplesExamples

Book Example 1.1

General Problem Solving General Problem Solving TechniquesTechniques Think about the problem before you solve

it Draw a sketch to visualize it Understand the overall purpose of the

problem and its key points Ask yourself: what information is known?

And what information must be determined?

Ask yourself: what fundamental engineering principles apply?

General Problem Solving General Problem Solving Techniques – Cont’dTechniques – Cont’d Think about how you will solve the

problem Develop your solution in an orderly and

logical manner Think about the solution: does it make

sense? Make sure solution is clear and complete

Problem solving is a skill that takes time and practice

Engineering FundamentalsEngineering Fundamentals

Equilibrium (e.g., force, flux or chemical equilibrium)

Conservation laws (mass, energy)Rate phenomena

Mathematical Solution Mathematical Solution ProceduresProcedures Data Analysis Curve-fitting Interpolation Solving single algebraic equations Solving simultaneous algebraic equations Evaluating integrals Engineering economic analysis Optimization techniques

Chapter 2. Creating an Excel Chapter 2. Creating an Excel WorksheetWorksheet

Spreadsheet BasicsSpreadsheet Basics

basically a table containing numeric or alphanumeric values

Individual elements are called cells Cells can contain a number or text A cell reference is its column heading and

row number, e.g., B3 Tabular collection of cells is called a

worksheet Cells contain numbers resulting from

formulas

Definitions Definitions

Ribbon: upper portion of the windowTitle Bar: top lineOffice Button: replaced the File MenuRibbon Tabs: below title bar, replaced

menu headingsWorksheet Tabs: beneath worksheetScroll bars: horizontal and verticalStatus bar: bottom line

Skills to learn in ExcelSkills to learn in Excel

Moving around the worksheet Entering data– 2, -6, 3.33, 2.55e-12, -7.08e+6, 0.0, 0.004– $25, 50%, 5/24/2006, 7:20 PM, 19:20:00

Entering strings or label (text) Correcting errors Using formulas and functions Naming a cell or worksheet Saving, retrieving and printing worksheets

Operators in ExcelOperators in Excel

Arithmetic: +, -, *, /, ^, % String: & Comparison: >, >=, <, <=, =, <> Operator precedence:– 1 percentage (%)– 2 exponentiation (^)– 3 Multip/division (* and /)– 4 Add/subtract (+ and -)– 5 concatenation (&)– 6 comparisons (>, <, …)

Operations carried out from left to right

Functions in ExcelFunctions in Excel

Function consists of a:– Function name– Arguments

Example: SUM(C1,C2,C3)

The function is the sum of cells C1,C2,C3

ExamplesExamples

Book Examples 2.4 &2.5

Chapter 3. Editing an Excel Chapter 3. Editing an Excel WorksheetWorksheet

More skills to learn in ExcelMore skills to learn in Excel

Selecting a block of cellsClearing a block of cellsCopying to adjacent cells by

draggingCopying to nonadjacent cellsMoving a block of cellsUndoing changes

Copying and Moving FormulasCopying and Moving Formulas

Relative vs. Absolute addressingA1+B1 vs. $A$1+$B$1

Moving a formula will not change cell addressesbut copying does

If an object cell is moved, the formula is changed to reflect the move

C1=A1+B1If A1 is moved to B5thenC1=B5+B1

Yet more skills to learn in ExcelYet more skills to learn in Excel

Inserting and deleting rows and columns

Inserting or deleting cellsAdjusting column width or row

heightFormatting data itemsHyperlinksDisplaying cell formulas

Chapter 4. Making Logical Chapter 4. Making Logical Decisions (If-Then-Else) Decisions (If-Then-Else)

The IF FunctionThe IF Function

Requires 3 arguments: logical expression, value for true, value for false

=IF(C1>100, “Too Big”, “Ok”)Nested IF functions:

=IF(A3<0, “Ice”, IF(A3<100, “Water”, “Steam”))

ExampleExample

Book Example 4.2

Chapter 5. Graphing DataChapter 5. Graphing Data

ExamplesExamples

Book Examples 5.1&5.3

Chapter 6. Analyzing Data Chapter 6. Analyzing Data StatisticallyStatistically

Data Analysis - StatisticsData Analysis - Statistics

Engineers gather data to measure variability or consistency– Example: diameters of ball bearings off

an assembly line– Another example: variation in sizes

among customers to determine how many items of each size to manufacture

Statistical data analysis tells us about data

Data CharacteristicsData Characteristics

Mean or average: expected behavior Median: a value such that half the data

values lie above and half lie below

8, 10, 12, 14, 16, 18, 22, 25, 29

5, 8, 12, 16, 18, 22, 27, 29 Mode: value that occurs the most in a data

set

10, 5, 8, 9, 3, 10, 7 Mode is 10

Median is 17

More Data CharacteristicsMore Data Characteristics

Min and Max: smallest and biggest value in a dataset

Variance: an indication of the degree of spread in the data

s2 = 1/(n-1)*(xi-xm)2 where xm is mean and the summation is for all I from 1 to n

The greater the spread in the data, the larger the variance

Standard deviation: square root of the variance

ExampleExample

Book Example 6.1

Histogram or relative frequency plotHistogram or relative frequency plot

Describes how data are distributed within their range

Cumulative distribution allows us to estimate the likelihood that a data value associated with an item drawn at random is less than or greater than a specified value

How to construct a histogramHow to construct a histogram

Subdivide the range of the data into a series of adjacent equally spaced intervals

1st interval begins at smallest value Last interval extends to or beyond the

largest data value (the max) Fixed interval width Detemine how many values fall in each

interval

fi = ni/n where ni is the # of points in the ith interval

ExamplesExamples

Book Examples 6.3, 6.5, & 6.6

Chapter 7. Fitting Equations to Chapter 7. Fitting Equations to DataData

Fitting Equations to DataFitting Equations to Data

Statistics and Histograms analyze a set of single-value data: x1, x2, etc.

Engineers need to analyze two-value or paired (x,y) data

Different Methods:– Linear Interpolation– Fitting data with a curve

Linear InterpolationLinear Interpolation

P1

P2

y1

y2

x1 x2x

yy – y1

y2-y1

x – x1 x2-x1

=

ExampleExample

Book Example 7.2

Curve FittingCurve Fitting

Fitting a line or curve through pairs of data

Concept is to represent data with an equation (y = f(x))

Fit does not have to be exactGoal is to minimize the error

somehow between the line and the data (error between yi and y)

Error in Curve FittingError in Curve Fitting

For each data point Pi = (xi, yi), the error is the difference between yi and F(xi) or the calculated value of yi

ei = yi – f(xi)

Strategy is to pick a function f(xi) that minimizes ei

Straight Line FitStraight Line Fit

Method of Least SquaresY = ax +b– Two unknowns: a and b have to be

chosen carefully to minimize the sum of the squares of the errors

– Equations 7.7 and 7.8 in book– Two equations in 2 unknowns (a, b)

ExamplesExamples

Book Examples 7.5 & 7.6

Chapter 9. Transferring DataChapter 9. Transferring Data

Even more skills to learn in ExcelEven more skills to learn in Excel

Importing/exporting data from text files

Transferring data from and to Word or PowerPoint

Transferring graphs to Word or PowerPoint

Chapters 11. Solving Single Chapters 11. Solving Single EquationsEquations

Algebraic EquationsAlgebraic Equations

Linear – none of the unknowns are raised to a power or appear as arguments in a trig function, a log function, a square root etc.

Nonlinear – harder to solve

Finding Numerical Solutions Finding Numerical Solutions Using ExcelUsing ExcelGoal SeekSolver

ExamplesExamples

Book Examples 11.5 & 11.7

Chapters 12. Solving Chapters 12. Solving Simultaneous EquationsSimultaneous Equations

n-linear Equations in n unknownsn-linear Equations in n unknowns

a11x1 + a12x2 +a13x3+….+a1nxn = b1

a21x1 + a22x2 + a23x3+….+a2nxn = b2

….….….an1x1 + an2x2 + an3x3+….+annxn = bn

aij’s and b’s are knownxi’s are unknown

i = rowj = column

MatrixMatrix

Is a two dimensional array of numbers Elements characterized by a row number

and a column number A matrix with one column is called a

vector System of equations on previous slide can

be written as:

AX = B

Example 12.1Example 12.1

Writing a System of Simultaneous Equations in Matrix Form

Matrix OperationsMatrix Operations

You can add, subtract, and multiply a matrix by a scalar

Matrices can be added if they have same number of rows and columns

A, B are m x n matrices

then

C = A + B is an m x n matrix

Matrix MultiplicationMatrix Multiplication

Matrices can also be multipliedA is an m x n matrix can be

multiplied by B if B is an n x p matrixThe result, matrix C will be an m x p

matrixExample 12.2 in book

Special MatricesSpecial Matrices

The identity matrix I and the inverse matrix A-1

I is a square matrix (n x n) and has the important property:– IA = AI = A

Inverse matrix (n x n) has the important property:– A-1 A = A A-1 = I

ExamplesExamples

Book Examples 12.7 & 12.8