lectures 5 and 6: engineering tools: spreadsheetsmason.gmu.edu/~cschaef3/lecture 5_6.pdf ·...
TRANSCRIPT
Lectures 5 and 6:Lectures 5 and 6:Engineering Tools: Spreadsheets
C S h fC. SchaeferDepartment of Electrical and Computer Engineering
George Mason Universityg y
Administrivia• The lecture slides are taken from Cengage Learning
Engineering and, except where otherwise noted, are the copyright of Cengage (publisher of your book)copyright of Cengage (publisher of your book).
• Homework:– Read Chapter 14
Chapter 14 Problem 14 12 and Problem 14 13– Chapter 14, Problem 14.12 and Problem 14.13.– You will need Microsoft Excel (or OpenOffice) to complete your
homework assignment. If you don’t own a copy, please complete your assignment in one of the many campus computer labs.
– Use two separate worksheets, one for each homework problem, saved to a single workbook with the following file name nomenclature:
• J_Smith_G1234_HW2 (first name initial; underscore; last name; underscore; the letter G followed by the last four digits of your G#; underscore; HW2)
l d f ll d d bl h l f h d f h• Include your full name, G #, date, and Problem # in the upper left hand portion of each worksheet. Name each worksheet with the appropriate Problem #.
– Email me your homework before the start of class on September 27th.– Bonus points for well‐formatted, “clean” spreadsheets.
2ENGR107 – Engineering Fundamentals
Impromptu Design Projects• Today’s Impromptu Design Project
Problem 3 11 in Chapter 3– Problem 3.11 in Chapter 3.– Two minor differences:
• You will be provided 6 feet of aluminum foilp• The boat must fit within a 8” x 6” rectangle (no height restriction)
• I will bring the pennies and the tub to test your designs• I will bring the pennies and the tub to test your designs.• You will have 20 minutes to complete your boat so begin thinking of a design
ENGR107 – Engineering Fundamentals 3
Computational Engineering ToolsUsing Available Software to Solve Engineering Problems:Problems:
• Electronic Spreadsheets
• MATLAB
4ENGR107 – Engineering Fundamentals
Outline
In this chapter we will• discuss basic makeup of Microsoft Excel• explain how a spreadsheet is divided into p prows and columns, and how to input data or a formula into an active cell
• explain the use of other tools such as Excel’s mathematical, statistical, and logical functionsfunctions
• explain how to plot results of an engineering analysisanalysis
5ENGR107 – Engineering Fundamentals
Objectives
The objective of this chapter is to introduce the Excel spreadsheet, which is p ,commonly used in solving engineering problemsproblems
© 2011 Cengage Learning Engineering. All Rights Reserved.
6ENGR107 – Engineering Fundamentals
Microsoft Excel – an Electronic Spreadsheet
• A tool that can be used to solve anA tool that can be used to solve an engineering problem
• Used to solve simpler engineering problems• Used to solve simpler engineering problems instead of using computer programs
C l d d i d• Commonly used to record, organize, and analyze data using formulas
• Used to present results of an analysis in chart form
© 2011 Cengage Learning Engineering. All Rights Reserved.
7ENGR107 – Engineering Fundamentals
Microsoft Excel – Basic Ideas
Title barFormula bar Toolbarbar Toolbar
buttonMenu bar
Column header
Name box
Row header
Active cell
Worksheet btabs
Status bar
© 2011 Cengage Learning Engineering. All Rights Reserved.
8ENGR107 – Engineering Fundamentals
Naming Worksheets
Double click this tab, type the name hit the Enter keyname, hit the Enter key
© 2011 Cengage Learning Engineering. All Rights Reserved.
9ENGR107 – Engineering Fundamentals
Moving Worksheets
Hold down the left button onHold down the left button on the mouse
and drag the tab to the desired locationlocation
© 2011 Cengage Learning Engineering. All Rights Reserved.
10ENGR107 – Engineering Fundamentals
Cell and AddressCell – represents the box that one sees as the result of the intersection of a row and a column Cell C4Cell C4
Wh i f l bWhat you get in active cell What you type in formula barWhat you get in active cell
© 2011 Cengage Learning Engineering. All Rights Reserved.
11ENGR107 – Engineering Fundamentals
Moving a Cell
Move content in cell A5 to cell C8
Move the mouse over cell A5 until the pointer becomes
while holding down the left button dragthe left button drag the mouse until the content of A5 is in C8, release the mouse buttonbutton
© 2011 Cengage Learning Engineering. All Rights Reserved.
12ENGR107 – Engineering Fundamentals
A Range
Range – cells that are selected simultaneously
After the range is selected, click the “name box” and type the name of rangethe name of range
Click on A3, drag the mouse while pressing down the left button to the last cell in the rangethe last cell in the range B10
© 2011 Cengage Learning Engineering. All Rights Reserved.
13ENGR107 – Engineering Fundamentals
Inserting Cellsg
select the cells whereselect the cells where the new cells are to be inserted cells inserted
At Home click on Cells
select Insert, then Insert Cells…
select shift cells down
At Home
© 2011 Cengage Learning Engineering. All Rights Reserved.
14ENGR107 – Engineering Fundamentals
Inserting Columnsselect Insert
select the column(s) where the new click on Cellscolumn(s) is to be inserted
column insertedAt Home
click on Cells
select Insert Sheet ColumnsColumns
© 2011 Cengage Learning Engineering. All Rights Reserved.
15ENGR107 – Engineering Fundamentals
Inserting Rows
select Insert
select the row(s) whereselect the row(s) where the new row(s) is to be inserted rows
insertedAt Homeclick on Cells
select Insert Sheet RowsSheet Rows
© 2011 Cengage Learning Engineering. All Rights Reserved.
16ENGR107 – Engineering Fundamentals
Creating Formulas in Excel
Basic Excel Arithmetic Operations
© 2011 Cengage Learning Engineering. All Rights Reserved.
17ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas
RTP
=ρGiven: standard air using the ideal gas law RT
⎟⎞
⎜⎛ J
g gwhereP = standard atmosphere pressure = 101.3 kPaR = gas constant for air = 286.9T = air temperature in Kelvin (K) ⎟⎟
⎠⎜⎜⎝ ⋅Kkg
T = air temperature in Kelvin (K)
Find: use Excel to create a table that shows the density of air as a function of temperature in the range of 0°C (273.15 K) ot 50°C (323.15 K) in i t f 5°Cincrement of 5°C.
( )K 273Kkg
J 286.9
Pa 101300
+=
Tρ
Kkg ⋅© 2011 Cengage Learning Engineering. All Rights Reserved.
ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
Solution:
Substituting the values of R and P in the standard gas law yields,
( )K273J286 9
Pa 101300=
Tρ
( )K273Kkg
286.9 +⋅
T
Now we can use the above equation to create the table in Excel.
© 2011 Cengage Learning Engineering. All Rights Reserved.
ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
1. In cell A1, type Density of air as a function of temperature
2. In cells A3 and B3, type Temperature (C), Density (kg/m3), respectively.
3. In cells A5 and A6, type 0 and 5, respectivelyp y
© 2011 Cengage Learning Engineering. All Rights Reserved.
20ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
4. Pick cells A5 and A6 and use the fill command with the + handle to copy the pattern into cells A7 through A15
© 2011 Cengage Learning Engineering. All Rights Reserved.
21ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
5. In cell B5, type the formula =(101300)/((286.9)*(A5+273))
Result of formulaResult of formula
© 2011 Cengage Learning Engineering. All Rights Reserved.
22ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
Select the Fill icon
At Home menu
Select Down to copy
At Home menu
6. Select range formulas to cells B5 to B15Resulting density
gB5 to B15
© 2011 Cengage Learning Engineering. All Rights Reserved.
23ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
7. At Home menu, click Number button
Select “Number”Or use decimal icon to reduce # of decimal places
Select Number of
Click on Number tab
Select Number ofdecimal places
© 2011 Cengage Learning Engineering. All Rights Reserved.24ENGR107 – Engineering Fundamentals
Example 14.1 – Creating Formulas (continued)(continued)
Final results, cell contents were centered using the Alignment button from the Home menu
Final results Then click theThen, click the Center icon
© 2011 Cengage Learning Engineering. All Rights Reserved.
25ENGR107 – Engineering Fundamentals
Cell Reference
Wh i f l h 3• When creating formulas, there are 3 ways to address a cell especially if the Fill
d i dcommand is used– Absolute cell reference
– Relative cell reference
– Mixed cell reference
© 2011 Cengage Learning Engineering. All Rights Reserved.
26ENGR107 – Engineering Fundamentals
Absolute Reference
• Absolute cell reference does not change• Absolute cell reference does not change when Fill command is used to copy the formula into other cellsformula into other cells
• Absolute cell reference is made by $ l l tt $ b $A$3$column‐letter$row‐number, e.g., $A$3
• Formulas will always refer to the content of the absolute cell regardless how the formulas are copied
© 2011 Cengage Learning Engineering. All Rights Reserved.
27ENGR107 – Engineering Fundamentals
Absolute Reference (continued)
Ab l t ll
Content of $A$3
Absolute cell reference
$A$3
Note the results ofNote the results of the formulas copied from cell B3.
© 2011 Cengage Learning Engineering. All Rights Reserved.
28ENGR107 – Engineering Fundamentals
Relative Reference• Relative reference changes in the formula when the Fill command is used to copy thewhen the Fill command is used to copy the formula into other cells
k l f $• To make a relative reference, $ sign is not needed in the cell address
© 2011 Cengage Learning Engineering. All Rights Reserved.
ENGR107 – Engineering Fundamentals
Relative Reference (continued)
Relative cell referencereference
Content of A3
Fill command was used to copy the formula in cell B3 to
=0.06*A7formula in cell B3 to B4 to B11.
© 2011 Cengage Learning Engineering. All Rights Reserved.
30ENGR107 – Engineering Fundamentals
Mixed Reference• Mixed reference can be done in one of two ways:ways:– keep column absolute and row relative, e.g., $A3
k l l d b l $– keep column relative and row absolute, e.g., A$3
© 2011 Cengage Learning Engineering. All Rights Reserved.
31ENGR107 – Engineering Fundamentals
Example 14.2 – Cell Reference
Given: interest rate ranges from 6% to 8% and principle ranges from $1000 to $3000$3000.
Find: Using Excel, create a table that shows the relationship between the interest earned and the amount deposited in increments shown in the table
© 2011 Cengage Learning Engineering. All Rights Reserved.
32ENGR107 – Engineering Fundamentals
Example 14.2 – Cell Reference (continued)
Find (continued):
Relationship between interested earned and amount deposited
Solution:
( ) ⎟⎠⎞
⎜⎝⎛×=
100%(%) rateinterest despositedamount earnedinterest
⎠⎝ 100%
© 2011 Cengage Learning Engineering. All Rights Reserved.
33ENGR107 – Engineering Fundamentals
Example 14.2 – Cell Reference (continued)Solution (continued): Type cell formula, note
the use of mix reference
Use Fill command to copy formula from cell B3 to cells C3:E3
Use Fill command to copy formulas fromcopy formulas from cells B3:E3 to cells B4:E11
© 2011 Cengage Learning Engineering. All Rights Reserved.
34ENGR107 – Engineering Fundamentals
Excel Functions
• Excel functions are grouped into categories– MathematicalT i t i– Trigonometric
– Statistical– FinancialFinancial– Logical
• Function can be entered in any cell byy y– typing the function name– using the Paste Function (fx) button
© 2011 Cengage Learning Engineering. All Rights Reserved.
35ENGR107 – Engineering Fundamentals
Excel FunctionClick the Function button in the Home
Select a function category
menu
the answer
Select functionType in formula with SUMSelect function
SUM for cell E1
Help link
with SUMfunction
© 2011 Cengage Learning Engineering. All Rights Reserved.
36ENGR107 – Engineering Fundamentals
Some Excel Functions
© 2011 Cengage Learning Engineering. All Rights Reserved.37ENGR107 – Engineering Fundamentals
Additional Excel Functions
© 2011 Cengage Learning Engineering. All Rights Reserved.ENGR107 – Engineering Fundamentals
Example 14.3 – Excel Functions
Given: an Excel worksheet shown in which columns A and B contain the data range which we have named values; cell D1 ;contains the angle 180.
Find: familiarize yourself with some of theFind: familiarize yourself with some of the Excel functions used in the cells E1 through E14E14.
Solution: see Excel functions listed in the next slide
© 2011 Cengage Learning Engineering. All Rights Reserved.
39ENGR107 – Engineering Fundamentals
Example 14.3 – Excel Functions (continued)(continued)
E1 SUM(A1 B10)E1: =SUM(A1:B10)E2: =AVERAGE(A1:B10)E3: =COUNT(A1:B10)E4: =MAX(A1:B10)E4: =MAX(A1:B10)E5: =MIN(A1:B10)E6: =STDEV(A1:B10)E7: =PI()()E8: =DEGREES(PI())E9: =RADIANS(90)E10: =RADIANS(D1)E11: =COS(PI()/2)E12: =COS(RADIANS(D1))E13: =SIN(PI()/2)E14 SIN(RADIANS(D1))E14: =SIN(RADIANS(D1))
© 2011 Cengage Learning Engineering. All Rights Reserved.
ENGR107 – Engineering Fundamentals
Now and Today FunctionsNow and Today functions
Now and Today function values updated automaticallyy p y
© 2011 Cengage Learning Engineering. All Rights Reserved.
41ENGR107 – Engineering Fundamentals
Excel Functions – Example Given: the water data shown below
Find: use Excel to compute the average and standard deviation of the density ofFind: use Excel to compute the average and standard deviation of the density of water data
© 2011 Cengage Learning Engineering. All Rights Reserved.
42ENGR107 – Engineering Fundamentals
Excel Functions – Example
Step 1, type
Solution:
Step 1, type headingsStep 2, type headings
Step 3, type in the density values
Step 4, type AVERAGE
Step 5
B16: =average(B5:B14)Step 6, type STAND. DEV.
St 7 C16: =average(C5:C14)Step 7
B18: =stdev(B5:B14)
C18: =stdev(C5:C14)( )
© 2011 Cengage Learning Engineering. All Rights Reserved.
43ENGR107 – Engineering Fundamentals
Excel Logical Functions• Logical functions allow us to test various conditions when programming formulas toconditions when programming formulas to analyze data
l l ll• Relational or comparison operators allow us to test relative magnitude of various arguments
© 2011 Cengage Learning Engineering. All Rights Reserved.
44ENGR107 – Engineering Fundamentals
Excel’s Logical Functions
© 2011 Cengage Learning Engineering. All Rights Reserved.
ENGR107 – Engineering Fundamentals
Excel’s Relational or Comparison Operators
© 2011 Cengage Learning Engineering. All Rights Reserved.
46ENGR107 – Engineering Fundamentals
Example 14.5 – Excel Logical Functions
Given: the pipeline shown is connected to a control (check) valve that open h th i th li h 20 i V i di t k twhen the pressure in the line reaches 20 psi. Various readings were taken at
different times and recorded.
Find: Using Excel’s logical functions, create a list that shows the corresponding open and closed position of the check valve
Check valve
© 2011 Cengage Learning Engineering. All Rights Reserved.
47ENGR107 – Engineering Fundamentals
Example 14.5 – Excel Logical Functions (continued)(continued)
Solution: Check valve opens when pressure in line reaches 20 psi
Check valve
Formula using logical function IFand relative operator >=
Use Fill command to copy formula in cell B3 to cells B4 to B10B10
Type in the values in column A
© 2011 Cengage Learning Engineering. All Rights Reserved.
48ENGR107 – Engineering Fundamentals
Plotting with Excel• Use Excel to create charts such as
Histograms (column or bar charts)– Histograms (column or bar charts)– Pie charts– Line charts– Line charts– XY charts
• Most charts we create as engineers are xy‐• Most charts we create as engineers are xy‐type charts
• Chart Wizard walk you through the necessaryChart Wizard walk you through the necessary steps to create a chart
© 2011 Cengage Learning Engineering. All Rights Reserved.
49ENGR107 – Engineering Fundamentals
Example 14.6 – Plotting
Given: the results from Example 14 1Given: the results from Example 14.1
Find: create a graph showing the value of i d it f ti f t tair density as a function of temperature.
© 2011 Cengage Learning Engineering. All Rights Reserved.
50ENGR107 – Engineering Fundamentals
Example 14.6 – Plotting (continued)Solution:
Click Insert
Select Chart Wizardi
tab
icon
Click Scatter plot
Select XY plot with line
Select the data range
© 2011 Cengage Learning Engineering. All Rights Reserved.
51ENGR107 – Engineering Fundamentals
Example 14.6 – Plotting (continued)Solution (continued): the chart is shown to the right of the data
© 2011 Cengage Learning Engineering. All Rights Reserved.
52ENGR107 – Engineering Fundamentals
Example 14.6 – Plotting (continued)Solution (continued): add axis and chart titles by clicking the Layout tab under Chart Tool menu and make necessary modifications
Layout tab
Chart Title and Axis Title iconsAxis Title icons
© 2011 Cengage Learning Engineering. All Rights Reserved.
53ENGR107 – Engineering Fundamentals
Plotting Two Data Sets with Different Ranges on the Same ChartSame Chart
Temperature as a function of time
Scale for wind speed
Scale for temperature Wind speed as a
function of time
© 2011 Cengage Learning Engineering. All Rights Reserved.
54ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets
Given: an empirical relationship between fuel consumption and car speed is given below. Note: V is the speed of the car if mph and the given relationship g p p g pis valid for 20 ≤ V ≤ 75.
Find: plot the fuel consumption and car speed relationship in both miles per gallon and gallons per mile.
1000Gallon)per(Miles VnConsumptioFuel ×= 85.1900
Gallon)per (MilesV
nConsumptio Fuel+
© 2011 Cengage Learning Engineering. All Rights Reserved.
55ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
1. Using Excel and the given formula, compute the fuel consumption in miles per gallon and gallons per
Solution (continued):
miles per gallon and gallons per mile
the fuel consumption formula
These values are inverse of those in column B
© 2011 Cengage Learning Engineering. All Rights Reserved.
56ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
3 Choose Select Data
Solution (continued): refer to Example 14.6 to create the chart for the first set of data “Miles Per Gallon”, then go to step 2.
3. Choose Select Data …
2 right click on Chart area2. right click on Chart area
© 2011 Cengage Learning Engineering. All Rights Reserved.
57ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
Solution (continued): in the Select Data Source,
5. type in series name, and choose the Series X values, and Series Y values
4. click on the Add button
© 2011 Cengage Learning Engineering. All Rights Reserved.
58ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
Solution (continued): Format the curve for the second data set
Series
per Mile”
7. select
“Gallons
6. click on Format button under Chart Tools
8. click on Format Selection icon Chart ToolsSelection icon
© 2011 Cengage Learning Engineering. All Rights Reserved.
59ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
9. Select the Series Options tab,
Solution (continued): in Format Data Series,
10. Select the Secondary axis
11. Select Line Style tab 12. Pull down Dash type and make a selection
© 2011 Cengage Learning Engineering. All Rights Reserved.60ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
Solution (continued): add title to the secondary axis
13. Click the Layout tab under Chart Tools menu
14. Click the Axis Titles icon to add title for secondary axisadd title for secondary axis
© 2011 Cengage Learning Engineering. All Rights Reserved.
61ENGR107 – Engineering Fundamentals
Example 14.7 – Plotting of Two Data Sets (continued)(continued)
Solution (continued): Final results
0.06
0.07
20.00
25.00
0.03
0.04
0.05
10 00
15.00
ons
Per M
ile
es P
er G
allo
n
Miles Per Gallon
0.01
0.02
5.00
10.00
Gal
l
Mil e Gallons Per Miles
0.000.000 20 40 60 80
Speed (mph)
© 2011 Cengage Learning Engineering. All Rights Reserved.
62ENGR107 – Engineering Fundamentals
Matrix Computation with Excel• Matrix is an array of numbers, variables, or mathematical termsmathematical terms
• Size of a matrix is defined by its number of d lrows and columns
• We denote matrix by a boldface letter in brackets [ ] and { }
© 2011 Cengage Learning Engineering. All Rights Reserved.
63ENGR107 – Engineering Fundamentals
Matrix – Definitions
3 by 3 (3x3) matrix3 by 1 (3x1) column matrix
[ ] { }14261956
⎪⎬
⎫⎪⎨
⎧⎥⎤
⎢⎡
LNx
y ( ) matrix
[ ] { } 085
14261⎪⎭
⎬⎪⎩
⎨=⎥⎥⎥
⎦⎢⎢⎢
⎣−= LN
zy
[ ] [ ]3205 −=C[ ] [ ]1 by 4 (1x4) row matrix
An element of a matrix
© 2011 Cengage Learning Engineering. All Rights Reserved.14‐64
ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)
Given: matrices [ ] [ ] [ ] ⎪⎫
⎪⎧−
⎥⎤
⎢⎡ −
⎥⎤
⎢⎡ 1264050
Given: matrices [ ] [ ] [ ]⎪⎭
⎪⎬
⎪⎩
⎪⎨=
⎥⎥⎥
⎦⎢⎢⎢
⎣ −=
⎥⎥⎥
⎦⎢⎢⎢
⎣ −=
52
431327
929738 CBA
Find: Use Excel to perform the following operations:
(a) [A] + [B] = ?
(b) [ ] [b] ?(b) [A] – [b] = ?
(c) [A][B] = ?
(d) [A]{C} = ?
Read chapter 18 for more detailed discussion on
t i l b( ) [ ]{ }
matrix algebra
© 2011 Cengage Learning Engineering. All Rights Reserved.
65ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)
Solution: Type in appropriate values and characters for each matrixSolution: Type in appropriate values and characters for each matrix
Note: these are boldface
© 2011 Cengage Learning Engineering. All Rights Reserved.
66ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)
Type this Solution (continued): compute [A] + [B]
formula to add [A] and [B], then while holding downholding down the Ctrl and the Shift keys press the Enter key
Type the heading for part (a)
Select the range B9 to D11
part (a)
© 2011 Cengage Learning Engineering. All Rights Reserved.
67ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)Solution (continued): compute [A] – [B]; Repeat similar steps to calculate [A] – [B]. Use the formula =B3:D5-G3:I5.
Result of [A]+[B]
R lt f [A] [B]Result for [A] ‐ [B]
© 2011 Cengage Learning Engineering. All Rights Reserved.
68ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)Solution (continued): compute [A][B]
Type the formula =MMULT(B3:D
e [A][B] =
5,G3:I5). While holding down the Ctrl and the Shift keys
Type
Select the range for the result to be displayed
press the Enterkey
© 2011 Cengage Learning Engineering. All Rights Reserved.
69ENGR107 – Engineering Fundamentals
Example 14.8 – Matrix Algebra (continued)Solution (continued): compute [A]{C}; Repeat similar steps to calculate [A]{C}. Use the formula =MMULT(B3:D5,L3:L5).
Result for [A][B]
Result for [A]{C}
© 2011 Cengage Learning Engineering. All Rights Reserved.
70ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations
Given: system of linear equations
32423132 321
=++=++
xxxxxx
173532423
321
321
=+−=++
xxxxxx
Find: x1, x2, x3
© 2011 Cengage Learning Engineering. All Rights Reserved.
71ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Solution: The system of linear equations can be written into matrix form as sho nform as shown. .
⎪⎫
⎪⎧
⎪⎫
⎪⎧
⎥⎤
⎢⎡ 13112 1x
[ ] { } { }⎪⎭
⎪⎬
⎪⎩
⎪⎨=
⎪⎭
⎪⎬
⎪⎩
⎪⎨=
⎥⎥⎥
⎦⎢⎢⎢
⎣ −=
1732
315423
3
2 BXAxx
The solution to this problem is discussed in detail in Chapter 18The solution to this problem is discussed in detail in Chapter 18
© 2011 Cengage Learning Engineering. All Rights Reserved.
72ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Solution (continued): type the appropriate characters and values for ( ) yp pp p[A], {B}, and {C}
© 2011 Cengage Learning Engineering. All Rights Reserved.
73ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Solution (continued): compute the inverse matrix of [A]
Type the formula =MINVERSE(B3:D5), then while holding down the Ctrl and the Shift keys ypress the Enter key
Type [A]‐1 =Select the range of cells where [A]‐1 will be displayedType [A] [A]‐1 will be displayed
© 2011 Cengage Learning Engineering. All Rights Reserved.
74ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Solution (continued):
Result for [A]‐1Result for [A]
© 2011 Cengage Learning Engineering. All Rights Reserved.
75ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Type the formula
Solution (continued): solving for {X}
yp=MMULT(B9:D11,K3:K5),then while holding down the Ctrl and the Shift keys press the Enter keyy
Select the range of cells where the values of {X} will
T thi
be displayed
Type this
© 2011 Cengage Learning Engineering. All Rights Reserved.
76ENGR107 – Engineering Fundamentals
Example 14.9 – System of Linear Equations (continued)(continued)
Solution (continued): Final results
Answer: values of x1, x2, and x3
© 2011 Cengage Learning Engineering. All Rights Reserved.
77ENGR107 – Engineering Fundamentals
Curve Fitting with Excel• Curve fitting deals with finding an equation that best fits a set of datathat best fits a set of data
• More applications in numerical methods and h f lother future engineering classes
© 2011 Cengage Learning Engineering. All Rights Reserved.
78ENGR107 – Engineering Fundamentals
Curve Fitting with Excel Procedures
• Plot data using steps described in previous sections• With the mouse pointer over the data points, right‐
click the mouse button• Select Add Trendline• Select Add Trendline• In Add Trendline dialog box
– choose the Trend/Regression type desiredchoose the Trend/Regression type desired – click the Options tab and toggle on
• Set intercept =• Display equation on chart
© 2011 Cengage Learning Engineering. All Rights Reserved.
79ENGR107 – Engineering Fundamentals
Example 14.10 – Curve FittingGiven: From Chapter 10, we learned that a spring force is given by the equation below. The force‐deflection data are plotted as shown.
kF kxF =
x
© 2011 Cengage Learning Engineering. All Rights Reserved.
80ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
Find: use Excel to obtain an equation that best fits the data.
Solution: Use the XY (Scatter) plot (without connecting points to create theSolution: Use the XY (Scatter) plot (without connecting points to create the plot blow
© 2011 Cengage Learning Engineering. All Rights Reserved.
81ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
l dd
Solution (continued): With the mouse pointer on the data points, right-click the mouse button. Then select Add Trendline
Select Add Trendline
© 2011 Cengage Learning Engineering. All Rights Reserved.
82ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
Select Trend/
Solution (continued): in Format Trendline,
Regression Type
Toggle Set Intercept = 0and Display Equation onand Display Equation on Chart
© 2011 Cengage Learning Engineering. All Rights Reserved.
83ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
Solution (continued): Final display of trendline
© 2011 Cengage Learning Engineering. All Rights Reserved.
84ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
Solution (continued): Final display of trendline
F = 0.5542x, where F = load (N), and x = deflection (mm)20
25
15
Load
(N) Edit the equation
as desired
5
10L
00 5 10 15 20 25 30 35 40
Deflection (mm)
© 2011 Cengage Learning Engineering. All Rights Reserved.
85ENGR107 – Engineering Fundamentals
Example 14.10 – Curve Fitting (continued)
Solution (continued): comparison between the measured and predicted spring force is given belowspring force is given below
© 2011 Cengage Learning Engineering. All Rights Reserved.
86ENGR107 – Engineering Fundamentals
Example 14.11 – Curve FittingGiven: a set of data points.
Fi d th ti th t b t fit th d t hFind: the equation that best fits the data shown
© 2011 Cengage Learning Engineering. All Rights Reserved.
87ENGR107 – Engineering Fundamentals
Example 14.11 – Curve Fitting (continued)Solution: Plot the data as described in previous sections, with the mouse pointer on the data points right-click the mouse button. Then select Add Trendline (see Example 14 10 for more detail)Add Trendline (see Example 14.10 for more detail).
Select Add ddTrendline
© 2011 Cengage Learning Engineering. All Rights Reserved.
88ENGR107 – Engineering Fundamentals
Example 14.11 – Curve Fitting (continued)
Select Trend/
Solution (continued): in Format Trendline,
Regression Type
Toggle Display Equation on Chart and Display R‐squaredChart and Display R squared value on Chart
© 2011 Cengage Learning Engineering. All Rights Reserved.
89ENGR107 – Engineering Fundamentals
Example 14.11 – Curve Fitting (continued)
Solution (continued): The resulting quadratic curve, equation and R2
value. R2 is the coefficient of determination; R2 = 1 a perfect fit, andvalue. R is the coefficient of determination; R 1 a perfect fit, and R2 0 an extremely poor fit
© 2011 Cengage Learning Engineering. All Rights Reserved.
90ENGR107 – Engineering Fundamentals
Example 14.11 – Curve Fitting (continued)
Solution (continued): comparison between actual and predicted y valuesvalues
© 2011 Cengage Learning Engineering. All Rights Reserved.
91ENGR107 – Engineering Fundamentals
Summary
• You should know that a spreadsheet is a ptool that can be used to solve an engineering problem
d h h l f– use a spreadsheet to present the results of an analysis in a chart form
– input your own formulasinput your own formulas– use the built‐in functions provided by the spreadsheet
h ld k h d• You should know how to move around in a workbook and input into different cells.
© 2011 Cengage Learning Engineering. All Rights Reserved.
92ENGR107 – Engineering Fundamentals
Summary (continued)
• You should know how to edit the contentYou should know how to edit the content of a cell.
• You should know how to select multipleYou should know how to select multiple cells and create a range.
• You should realize you can name a rangeYou should realize you can name a range and use the name in formulas or in plotting data.p g
• You should understand how to refer to a cell by its address.y
© 2011 Cengage Learning Engineering. All Rights Reserved.
93ENGR107 – Engineering Fundamentals
Summary (continued)• You should know the difference among a cell’s relative absolute and mixed addressrelative, absolute, and mixed address.
• You should know when to use the proper cell dd h f laddress when creating formulas.
• You should be familiar with Excel’s built‐in functions.
• You should know how to insert cells, columns, , ,and rows in an existing worksheet.
© 2011 Cengage Learning Engineering. All Rights Reserved.
94ENGR107 – Engineering Fundamentals
Summary (continued)• You should know how to create a proper engineering chart using Excelengineering chart using Excel.
• You should know how to perform matrix h loperations with Excel.
• You should know how to perform curve fitting with Excel.
© 2011 Cengage Learning Engineering. All Rights Reserved.
95ENGR107 – Engineering Fundamentals