what every engineer excel - droppdf1.droppdf.com/files/udrqw/what-every-engineer... · about the...

239

Upload: others

Post on 09-Mar-2020

19 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State
Page 2: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

What Every EngineerShould Know About

EXCEL

Page 3: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

WHAT EVERY ENGINEER SHOULD KNOW

A Series

Series Editor*

Phillip A. Laplante

Pennsylvania State University

1. What Every Engineer Should Know About Patents, William G. Konold, Bruce Tittel, Donald F. Frei, and David S. Stallard

2. What Every Engineer Should Know About Product Liability, James F. Thorpe and William H. Middendorf

3. What Every Engineer Should Know About Microcomputers:Hardware/Software Design, A Step-by-Step Example, William S. Bennett and Carl F. Evert, Jr.

4. What Every Engineer Should Know About Economic DecisionAnalysis, Dean S. Shupe

5. What Every Engineer Should Know About Human ResourcesManagement, Desmond D. Martin and Richard L. Shell

6. What Every Engineer Should Know About Manufacturing CostEstimating, Eric M. Malstrom

7. What Every Engineer Should Know About Inventing, William H. Middendorf

8. What Every Engineer Should Know About Technology Transfer and Innovation, Louis N. Mogavero and Robert S. Shane

9. What Every Engineer Should Know About Project Management,Arnold M. Ruskin and W. Eugene Estes

10. What Every Engineer Should Know About Computer-Aided Design and Computer-Aided Manufacturing: The CAD/CAM Revolution, John K. Krouse

11. What Every Engineer Should Know About Robots, Maurice I. Zeldman

12. What Every Engineer Should Know About Microcomputer SystemsDesign and Debugging, Bill Wray and Bill Crawford

13. What Every Engineer Should Know About Engineering InformationResources, Margaret T. Schenk and James K. Webster

14. What Every Engineer Should Know About Microcomputer ProgramDesign, Keith R. Wehmeyer

*Founding Series Editor: William H. Middendorf

WEE_SeriesPage.qxd6 3/27/06 2:56 PM Page 1

Page 4: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

15. What Every Engineer Should Know About Computer Modeling andSimulation, Don M. Ingels

16. What Every Engineer Should Know About Engineering Workstations,Justin E. Harlow III

17. What Every Engineer Should Know About Practical CAD/CAMApplications, John Stark

18. What Every Engineer Should Know About Threaded Fasteners:Materials and Design, Alexander Blake

19. What Every Engineer Should Know About Data Communications, Carl Stephen Clifton

20. What Every Engineer Should Know About Material and ComponentFailure, Failure Analysis, and Litigation, Lawrence E. Murr

21. What Every Engineer Should Know About Corrosion, Philip Schweitzer

22. What Every Engineer Should Know About Lasers, D. C. Winburn

23. What Every Engineer Should Know About Finite Element Analysis,John R. Brauer

24. What Every Engineer Should Know About Patents: Second Edition,William G. Konold, Bruce Tittel, Donald F. Frei, and David S. Stallard

25. What Every Engineer Should Know About Electronic CommunicationsSystems, L. R. McKay

26. What Every Engineer Should Know About Quality Control, Thomas Pyzdek

27. What Every Engineer Should Know About Microcomputers:Hardware/Software Design, A Step-by-Step Example. Second Edition,Revised and Expanded, William S. Bennett, Carl F. Evert, and Leslie C. Lander

28. What Every Engineer Should Know About Ceramics, Solomon Musikant

29. What Every Engineer Should Know About Developing PlasticsProducts, Bruce C. Wendle

30. What Every Engineer Should Know About Reliability and RiskAnalysis, M. Modarres

31. What Every Engineer Should Know About Finite Element Analysis:Second Edition, Revised and Expanded, John R. Brauer

32. What Every Engineer Should Know About Accounting and Finance,Jae K. Shim and Norman Henteleff

33. What Every Engineer Should Know About Project Management:Second Edition, Revised and Expanded, Arnold M. Ruskin and W. Eugene Estes

34. What Every Engineer Should Know About Concurrent Engineering,Thomas A. Salomone

35. What Every Engineer Should Know About Ethics, Kenneth K. Humphreys

WEE_SeriesPage.qxd6 3/27/06 2:56 PM Page 2

Page 5: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

36. What Every Engineer Should Know About Risk Engineering andManagement, John X. Wang and Marvin L. Roush

37. What Every Engineer Should Know About Decision Making UnderUncertainty, John X. Wang

38. What Every Engineer Should Know About Computational Techniquesof Finite Element Analysis, Louis Komzsik

39. What Every Engineer Should Know About Excel, Jack P. Holman

ADDITIONAL VOLUMES IN PREPARATION

WEE_SeriesPage.qxd6 3/27/06 2:56 PM Page 3

Page 6: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

CRC is an imprint of the Taylor & Francis Group,an informa business

What Every EngineerShould Know About

J. P. HolmanSouthern Methodist University

Boca Raton London New York

EXCEL

Page 7: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

CRC PressTaylor & Francis Group6000 Broken Sound Parkway NW, Suite 300Boca Raton, FL 33487-2742

© 2006 by Taylor & Francis Group, LLCCRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government worksVersion Date: 20110713

International Standard Book Number-13: 978-1-4200-0719-0 (eBook - PDF)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid-ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti-lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy-ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe.

Visit the Taylor & Francis Web site athttp://www.taylorandfrancis.com

and the CRC Press Web site athttp://www.crcpress.com

Page 8: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

About the Author

J.P. Holman

received a Ph.D. in mechanical engineeringfrom Oklahoma State University. After research experienceat the Air Force Aerospace Research Laboratories, he joinedthe faculty of Southern Methodist University, Dallas, Texas. Dr. Holman has published over 30 papers in several areasof heat transfer and is the author of three widely usedbooks:

Heat Transfer

(9th edition, 2002),

Thermodynamics

(4th edition, 1988), and

Experimental Methods for Engineers

(7th edition, 2000). These books have been translated intoSpanish, Chinese, Japanese, Korean, Portuguese, Thai, andIndonesian and are distributed worldwide. A fellow of ASME, Dr. Holman is a recipient of the

Worcester Reed Warner Gold Medal

and the

James Harry PotterGold Medal

from ASME for distinguished contributions tothe permanent literature of engineering. He is also the recipient of the American Societyfor Engineering Education’s

George Westinghouse

and

Ralph Coats Roe Awards

for distin-guished contributions to mechanical engineering education.

7326_C000.fm Page 9 Wednesday, March 29, 2006 5:50 AM

Page 9: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C000.fm Page 10 Wednesday, March 29, 2006 5:50 AM

Page 10: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Preface

This collection of materials involving operations in Microsoft Excel is intended primarilyfor engineers, although many of the displays and topics will be of interest to other readersas well. The procedures have been generated somewhat randomly as individual segments,which were distributed to classes as the need arose. They do not take the place of themany excellent books on the subjects of numerical methods, statistics, engineering anal-ysis, or the information that is available through the Help/Index features of the softwarepackages. Some of the suggestions offered herein will be obvious to an experienced userof the software but much less apparent or even eye-opening to others. It is this latter groupfor whom the collection was assembled.

Some of the materials were written for use in classes in engineering laboratory and heat-transfer subjects, so several of the examples are tainted in the direction of these applica-tions. Even so, topics such as solutions to simultaneous linear and nonlinear equationsand uses of graphing techniques are pervasive and easily extended to other applications.

The reader will notice that a basic familiarity with spreadsheets, the formats for enteringequations, and a basic knowledge of graphs is assumed. A basic acquaintance withMicrosoft Word is also expected, including simple editing operations.

The Table of Contents furnishes a fairly straightforward guide for selecting topics fromthe book. It must be noted that the topics are presented as stand-alone items in manycases, which do not necessarily depend on previous sections. Where previous topics arerelevant they are noted in that section. The reader will find that some topics are repeated— such as instructions for formatting graphs and charts — where it was judged beneficial.

In Chapter 1 the convention employed for sequential sets of operations is noted alongwith the background expected of the reader. The user will find the suggested customkeyboard setup in Section 2.3 to be very useful for typing equations and math symbols.While possibly of infrequent use, the application of photo inserts is discussed in Section2.9. Increased use of scanners and digital cameras may add to the utility of these sections.

Most engineering graphs are of the x-y scatter variety, and the combination of theinformation presented at Section 3.3 and suggested default settings at Section 3.22 shouldbe quite helpful in application of these graphs. Most people do not think of using Excelto generate line drawings. The discussion in Section 4.2 illustrates the relative simplicityof making such drawings and embedding them in Excel and Word documents. Section4.3 and Section 4.5 illustrate methods for inserting and combining symbols, equations,and graphics in both Excel and Word.

Chapter 5 presents methods for solving single or simultaneous sets of linear or nonlinearequations. Section 5.4 presents an iterative method that is particularly useful for solvinglinear nodal equations in applications with sparse coefficient matrices. Histograms, cumu-lative frequency distributions, and normal probability functions are discussed in Chapter6 along with several regression methods. Three regression techniques are applied to anexample that analyzes the performance of a commercial air-conditioning unit.

Because financial analysis is frequently a part of engineering design, Chapter 7 presentsan abbreviated view of the built-in Excel financial functions. Several examples of the useof these functions are also given. Optimization techniques are also a part of engineeringdesign, so Chapter 8 gives a brief view of the use of the Solver feature of Excel for analyzingsuch problems.

7326_C000.fm Page 11 Wednesday, March 29, 2006 5:50 AM

Page 11: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot tables are employed for arranging and categorizing small or large sets of data intodifferent formats. In the presentation in Chapter 9, the approach has been to employ theiruse not only for rearranging tabular information but also for inserting calculated resultsof interest. This presentation then becomes a vehicle to supplement the creation of datatables and charts by other means.

J.P. Holman

7326_C000.fm Page 12 Wednesday, March 29, 2006 5:50 AM

Page 12: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Contents

1

Introduction

..........................................................................................................11.1 Getting the Most from Excel ................................................................................................11.2 Conventions ............................................................................................................................21.3 Outline of Contents ...............................................................................................................3

2

Miscellaneous Operations in Excel and Word

..................................................52.1 Introduction.............................................................................................................................52.2 Print Screen or Screen Dump...............................................................................................52.3 Custom Keyboard Setup for Symbols in Word ................................................................72.4 Viewing or Printing Column and Row Headings and Gridlines in Excel...................82.5 Assorted Instructions.............................................................................................................82.6 Moving Objects in Small Increments (Nudging)............................................................102.7 Formatting Objects in Word, Including Wrapping ........................................................112.8 Formatting Objects in Excel ...............................................................................................112.9 Use of Photo-Editing Software in Word, Including Wrapping ....................................112.10 Copying Cell Formulas: Effect of Relative and Absolute Addresses..........................142.11 Copying Formulas by Dragging the Fill Handle ...........................................................152.12 Shortcut for Changing the Status of Cell Addresses .....................................................172.13 Switching and Copying Columns or Rows, and Changing Rows to

Columns or Columns to Rows ..........................................................................................172.14 Built-In Functions in Excel .................................................................................................182.15 Creating Single-Variable Tables Using the DATA/TABLE Command .......................192.16 Creating Two-Variable Tables Using the DATA/TABLE Command ..........................21Problems .........................................................................................................................................24

3

Charts and Graphs

.............................................................................................273.1 Introduction...........................................................................................................................273.2 Moving Dialog Windows....................................................................................................273.3 Excel Chart Wizard Window Showing Choice of x-y Scatter Charts .........................283.4 Selecting and Adding Data for x-y Scatter Charts .........................................................293.5 Changing and Adding Data for Charts Using the SOURCE DATA Command .......303.6 Adding Data to Charts Using the ADD DATA Command ..........................................303.7 Adding Trendlines and Correlation Equations to Scatter Charts................................313.8 Equation for R

2

.....................................................................................................................313.9 Correlation of Experimental Data with Power Relation ...............................................323.10 Use of Logarithmic Scales ..................................................................................................343.11 Correlation with Exponential Functions ..........................................................................353.12 Use of Different Scatter Graphs for the Same Data .......................................................36

3.12.1 Observations.............................................................................................................413.13 Plot of a Function of Two Variables with Different Chart Types ................................41

3.13.1 Changes in Gap Width and Chart Depth on 3-D Displays..............................443.14 Plots of Two Variables with and without Separate Scales............................................443.15 Charts Used for Calculation Purposes or G&A Format................................................45

7326_C000.fm Page 13 Wednesday, March 29, 2006 5:50 AM

Page 13: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

3.15.1 G&A Chart ................................................................................................................483.16 Stretching Out a Chart from a Single Chart Page..........................................................483.17 Alternate Chart Sizing Procedure Using MS Word .......................................................493.18 Calculation and Graphing of Moving Averages.............................................................50

3.18.1 Standard Error..........................................................................................................543.19 Bar and Column Charts ......................................................................................................553.20 Chart Format and Cosmetics .............................................................................................563.21 Surface Charts.......................................................................................................................583.22 Suggested Scatter Graph Setting as Default Chart ........................................................593.23 An Exercise in 3-D Visualization.......................................................................................633.24 Editing Excel Charts Using Word .....................................................................................633.25 Editing Excel Tables Using Word ......................................................................................653.26 Alternate Procedure.............................................................................................................673.27 Editing Excel Charts Directly in Word by Using Grouping .........................................69Problems .........................................................................................................................................72

4

Line Drawings and Embedded Objects in Excel

............................................774.1 Introduction...........................................................................................................................774.2 Constructing, Moving, and Inserting Straight Line Drawings ....................................77

4.2.1 Drawing Line Segments in Precise Angular Increments ..................................784.3 Inserting Items in Excel with Symbols, Subscripts, and Superscripts........................834.4 Inserting Equations or Symbols in Word Using Equation Editor ...............................854.5 Inserting Equations and Symbols in Excel Using Equation Editor.............................864.6 Construction of Line Drawings from Plotted Coordinates...........................................88Problems .........................................................................................................................................92

5

Solution of Equations

........................................................................................935.1 Introduction...........................................................................................................................935.2 Solutions to Single Nonlinear Equations Using Goal Seek ..........................................935.3 Solutions to Single Nonlinear Equations Using Solver.................................................955.4 Iterative Solutions to Simultaneous Linear Equations ..................................................985.5 Solutions of Simultaneous Linear Equations Using Matrix Inversion .......................99

5.5.1 Error Messages.......................................................................................................1035.6 Solutions of Simultaneous Nonlinear Equations Using Solver..................................1035.7 Solver Results Dialog Box ................................................................................................1105.8 Comparison of Methods for Solution of Simultaneous

Linear Equations ................................................................................................................1115.9 Copying Cell Equations for Repetitive Calculations ...................................................1125.10 Creating and Running Macros.........................................................................................113Problems .......................................................................................................................................118

6

Other Operations

..............................................................................................1216.1 Introduction.........................................................................................................................1216.2 Numerical Evaluation of Integrals..................................................................................1216.3 Use of Logical IF Statement .............................................................................................1256.4 Histograms and Cumulative Frequency Distributions ..............................................1286.5 Normal Error Distributions..............................................................................................1326.6 Calculation of Uncertainty Propagation in Experimental Results.............................1386.7 Fractional Uncertainties for Product Functions of Primary Variables ......................1426.8 Multivariable Linear Regression .....................................................................................145

7326_C000.fm Page 14 Wednesday, March 29, 2006 5:50 AM

Page 14: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

6.9 Multivariable Exponential Regression............................................................................150Problems .......................................................................................................................................158

7

Financial Functions and Calculations

............................................................1617.1 Introduction.........................................................................................................................1617.2 Nomenclature .....................................................................................................................1617.3 Compound Interest Formulas..........................................................................................1627.4 Investment Accumulation with Increasing Annual Payments...................................1687.5 Payout at Variable Rates from an Initial Investment...................................................168Problems .......................................................................................................................................171

8

Optimization Problems

....................................................................................1758.1 Introduction.........................................................................................................................1758.2 Graphical Examples of Linear and Nonlinear Optimization Problems ...................1768.3 Solutions Using Solver ......................................................................................................1798.4 Solver Answer Reports for Examples.............................................................................1828.5 Nomenclature for Sensitivity Reports ............................................................................1858.6 Nomenclature for Answer Reports .................................................................................1868.7 Nomenclature for Limits Reports....................................................................................186Problems .......................................................................................................................................186

9

Pivot Tables

.......................................................................................................1919.1 Introduction.........................................................................................................................1919.2 Other Summary Functions for Data Fields ...................................................................2049.3 Restrictions on Pivot Table Formulas .............................................................................207

9.3.1 Ordering of Data Fields and Resultant Graphs ...............................................2089.4 Calculating and Charting Single or Multiple Functions

f

(x) vs. x Using Pivot Tables.............................................................................................2129.5 Calculating and Plotting Functions of Two Variables .................................................216

9.5.1 Display of Formulas and Solve Order ...............................................................219Problems .......................................................................................................................................220

References

..................................................................................................................223

Index

...........................................................................................................................225

7326_C000.fm Page 15 Wednesday, March 29, 2006 5:50 AM

Page 15: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C000.fm Page 16 Wednesday, March 29, 2006 5:50 AM

Page 16: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

1

1

Introduction

1.1 Getting the Most from Excel

Microsoft Excel is a deceptive software package in that it offers computation and graphicscapabilities far beyond what one would expect in a spreadsheet tool and also because itscapabilities remain unknown to many engineers and technical persons. This book iswritten for the person who is casually familiar with Excel but is unaware of its broadpotential. Although a novice will find the material useful, it will be most attractive tothose who have the following:

1. A basic knowledge of both Excel and Word, including procedures for enteringequations in Excel, editing fundamentals, and some experience with creatinggraphs

2. A basic knowledge of differential and integral calculus3. For some sections, a familiarity with solution techniques for single and simulta-

neous equations4. For some sections, a familiarity with basic statistics, including the concepts of

standard deviation and probability

Many of the sections in this book resulted from small instructional sets that were writtenas stand-alone packages for engineering students enrolled in a mechanical engineeringcurriculum. In addition, some of the sets and example problems are related to applicationsin the thermal and fluids areas of mechanical engineering. Although these applicationexamples have been retained, they have been presented as part of more general proceduresthat will be applicable to other disciplines.

Unless a person works with a software package such as Excel on a continual basis, it iseasy to forget some of the shortcuts and nuances of operation that accomplish calculationor presentation objectives,

viz.,

procedures for viewing all equations on a worksheet,stretching graphs to multipage proportions, inserting symbols in equations, etc. Such hintshave been presented in compact form for the convenience of the reader.

The title of this book refers to Excel, but the reader will find several applications thatcall for a combination of features of Microsoft Word in conjunction with the capabilitiesof Excel. Most users of Excel will have the complete Microsoft Office Professional Suite,so no problem should arise. Microsoft PowerPoint is also a powerful tool for presentationsbut is not covered in this book.

The Help/Index features of both Excel and Word are of obvious practical utility inworking with the software. When appropriate, the reader’s attention is directed to specificindex items for further information. There are many books written on Excel and many

7326_C001.fm Page 1 Tuesday, March 7, 2006 6:16 AM

Page 17: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

2

What Every Engineer Should Know About Excel

specialized references that pertain to particular engineering examples. A list of all refer-ences for this book is given in the appendix, and callouts to this list are made at appropriatetimes in the book. Separate reference lists are not provided at the conclusion of eachchapter.

Many worked examples are presented throughout the book. For the reader’s conve-nience, each example is given a title. In some cases, the example title also specifies thecalculation principle or technique that is being demonstrated. Extensive use is made ofgraphs and figures, as well as of printouts of specific spreadsheet segments employed inthe examples. Screen dumps that show the worksheet and dialog window contents inperspective are also displayed.

The reader will find that many sections in the book can be used independently. Thisstand-alone nature results from the way many of the topics were generated initially, aswell as from an expectation that many readers want information in a compact self-contained form without having to move back and forth from section to section. To furtherachieve a compact presentation, explanatory notes are sometimes displayed as embeddedtext on the pertinent worksheet. When a topic relates to other sections, appropriate notesand references are given.

1.2 Conventions

As described earlier, many of the presentations herein are in a compact form, which allowsfor more rapid or convenient use. When specifying a procedure that consists of a sequenceof operations, we will use the following convention

VIEW/TOOLBARS/DRAWING/AUTOSHAPES/choose Freeforminstead of the more cumbersome set of instructions:

1. Click View.2. Click Toolbars.3. Click Drawing.4. Select AutoShapes.5. Select Freeform.

Another example in Excel isTOOLS/OPTIONS/VIEW/check Formulas

which is equivalent to the following:

1. Click on Tools.2. Click Options.3. Select the View tab.4. Check Formulas box to display all formulas.

Embedding of text boxes and descriptive Word statements in the example Excel work-sheets is freely employed to express the instructions in a compact form. In many casesthis results in a font size smaller than the main body of the text, but is usually notobjectionable.

7326_C001.fm Page 2 Tuesday, March 7, 2006 6:16 AM

Page 18: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Introduction

3

In these examples, the font selected for almost all of the text and graphics nomenclatureis Times New Roman. Equations requiring math or Greek symbols have mostly been typedin Word, using symbol shortcuts described at Section 2.3 of Chapter 2. A few complicatedformulas have been assembled using Equation Editor. Most of the charts are presentedwithout pattern fill and, of course, without color. A few charts were produced in colorand printed in grayscale.

1.3 Outline of Contents

Chapter 2 presents a potpourri of miscellaneous topics in Word and Excel that are appli-cable to the other chapters. Chapter 3 describes a number of graphing techniques thatmay be employed in engineering applications. Chapter 4 discusses use of line drawingsand other graphics in Word and Excel. Chapter 5 presents a variety of Excel techniquesfor solving single and multiple linear or nonlinear equations, along with numerical exam-ples of each technique. Chapter 6 presents some other numerical applications, includinghistograms and multivariable regression analysis, whereas Chapter 7 is devoted to dis-cussion and use of financial functions built into Excel. Chapter 8 presents some optimi-zation techniques that may be exploited with Excel Solver, and finally, Chapter 9 presentssome basic operations with pivot tables.

7326_C001.fm Page 3 Tuesday, March 7, 2006 6:16 AM

Page 19: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C001.fm Page 4 Tuesday, March 7, 2006 6:16 AM

Page 20: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

5

2

Miscellaneous Operations in Excel and Word

2.1 Introduction

This chapter contains a collection of hints and reminders for miscellaneous edit, format,and shortcut operations. The reader should take particular note of Section 2.3, which offersdetailed suggestions for customizing the keyboard for direct typing of math and Greeksymbols. Use of these shortcuts will greatly simplify typing of most equations and math-ematical expressions. For those that require more elaborate inserts, directions for employ-ing Equation Editor are given. For those who choose to have digital photo inserts, briefinstructions for their use are given in Section 2.9.

Some of the format and edit instructions will be repeated from time to time when theyare needed in a particular example or discussion.

2.2 Print Screen or Screen Dump

The following are instructions to print the current window or entire screen:

1. To activate the current window, press Alt + Print Screen keys.2. To activate entire screen, press Print Screen key.3. Click OK (or CLOSE, depending on the screen).4. Move to a desired document or worksheet by opening the document (START/

DOCUMENTS, etc.).5. Click the desired cell location in worksheet or location in document.6. Click EDIT/PASTE; the screen will appear at the desired location.7. Adjust size and location of screen by dragging, or click FORMAT/PICTURE/

SIZE, etc.8. Click FILE/PRINT PREVIEW to check the final arrangement.9. Activate the screen if it alone is to be printed. Make sure screen is not activated

if the entire worksheet or document is to be printed.10. Print as per the usual procedure. See Figures 2.1 and Figure 2.2.

7326_C002.fm Page 5 Tuesday, March 7, 2006 6:17 AM

Page 21: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

6

What Every Engineer Should Know About Excel

FIGURE 2.1

FIGURE 2.2

7326_C002.fm Page 6 Tuesday, March 7, 2006 6:17 AM

Page 22: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

7

2.3 Custom Keyboard Setup for Symbols in Word

The following procedure may be used to customize a keyboard setup for symbols:

1. Open new document.2. Click INSERT/SYMBOL.3. Select Font: Symbol or any other desired style.4. Click on the desired symbol.5. Click Shortcut key.6. Press alternative keys or combination of keys.7. Click ASSIGN.8. Click CLOSE.9. Repeat for as many symbols and characters as desired.

10. Close to return to document.

The customized keyboard can then be applied to all new documents. The symbol fontis shown in Figure 2.3, and a suggested custom setup for shortcut keys is shown in Figure2.4. For convenient use, we suggest that the setup be saved as Word Symbol Template inany desired file and then sent to the desktop as a shortcut. For use in a shared computer,the template can be saved on a floppy disk and then accessed when needed.

FIGURE 2.3

7326_C002.fm Page 7 Tuesday, March 7, 2006 6:17 AM

Page 23: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

8

What Every Engineer Should Know About Excel

2.4 Viewing or Printing Column and Row Headings and Gridlines in Excel

To view or print column and row headings and gridlines:

1. Click FILE/PAGE SETUP/SHEET/PRINT, check Gridlines and Row and ColumnHeadings. See Figure 2.5 and 2.6.

2. Click OK.

2.5 Assorted Instructions

For the following functions, the instructions are as follows (some are repeated in theexamples):

Plotting of empty cellsTOOLS/OPTIONS/CHART/choose empty cells not plotted, or zero.

Listing of recently used Word or Excel filesTOOLS/OPTIONS/GENERAL/choose number to list.

Moving and sizing charts and text boxes on a worksheetTo move the entire chart or text box, activate the chart by clicking on CHART

AREA, not PLOT AREA, and drag to the new location. Do not drag by sidehandles.

To resize the chart, activate the chart, click on the corners or side handles until adouble arrow appears, then drag to desired proportions.

FIGURE 2.4

7326_C002.fm Page 8 Tuesday, March 7, 2006 6:17 AM

Page 24: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

9

To move the entire text box in small increments, activate the text box. Hold downthe Ctrl button and move in small increments with the arrow keys.

Adding or removing fill to cells or text boxesActivate the object or area, click on the Fill icon in the Drawing toolbar, select Fill

color or pattern or No Fill.

Adding or removing line border to text boxActivate the object, click on the Line icon on the Drawing toolbar, and select the

desired option.

Changing border or drawing line weightsActivate the object, click on the Line Weight icon on the Drawing toolbar, and

make a selection.

Editing chartsActivate the chart. Click CHART/CHART OPTIONS/select from Titles, Axes,

Gridlines, Legend, and Data Labels tabs.

Displaying formulas in cellsTOOLS/OPTIONS/VIEW/WINDOW OPTIONS/check Formulas.

Adding (or deleting) sheet and page numbersFILE/PAGE SETUP/HEADER-FOOTER/choose the desired format.

Printing portrait or landscape page orientationFILE/PAGE SETUP/PAGE/choose the desired format.

Deleting in Word

Previous word delete: Ctrl + Backspace.Previous line delete: Alt + Backspace.Word forward delete: Ctrl + Delete.

Subscripts and superscripts in WordSubscript: Ctrl + equal sign.Reverse subscript: Ctrl + equal sign.Superscript: Ctrl + plus sign (using Shift).Reverse superscript: Ctrl + plus sign (using Shift).

Protecting WorksheetsTo prevent accidental typing over formulas or objects in a worksheet, it is possible

to lock the material in place by clicking TOOLS/PROTECTION/PROTECTSHEET. This action locks all the cell contents in the worksheet. To excludesome cells from the locking process:

1. Activate the cells (or row or column) to be excluded.

7326_C002.fm Page 9 Tuesday, March 7, 2006 6:17 AM

Page 25: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

10

What Every Engineer Should Know About Excel

2. Click FORMAT/CELLS/PROTECTION/remove the check mark fromLocked. This exclusion must be made before the locking process for theworksheet.

To reverse the protection action, click TOOLS/PROTECTION/UNPROTECTSHEET.

FIGURE 2.5

FIGURE 2.6

123456789

1011

A B C D E F GTEXT or FORMULA

To change font type or size for entire worksheet,click box in upper left hand corner between row 1and column A. Make changes. Then click A1 cell toactivate changes.NOTE: This will only change fonts in cells; it willnot change font in a text box like this. That must bechanged by clicking box, etc.

7326_C002.fm Page 10 Tuesday, March 7, 2006 6:17 AM

Page 26: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

11

2.6 Moving Objects in Small Increments (Nudging)

To move an object by small increments:

1. Select the object by clicking.2. Press the arrow keys to move object in desired direction.3. Hold down the Ctrl key while pressing the arrow keys to move the object by one-

pixel increments.

An alternate procedure, which is more complicated, is to click Draw on the Drawingtoolbar and then click the Nudge selection for the particular direction.

2.7 Formatting Objects in Word, Including Wrapping

Charts, graphs, drawing objects, pictures, and text boxes may all be copied to Word fromother sources,

viz.

, Excel, and then adjusted in size, position, or wrapped with text. Theprocedure for making these adjustments is as follows:

1. Activate the object, chart, drawing, or picture by clicking.2. Click FORMAT/Object, AutoShape, Picture, or Text Box. The dialog window will

appear as in Figure 2.7a for AutoShape (Drawing) object.3. Select the tab of interest. In Figure 2.7a the wrapping tab is selected with a choice

of Top and Bottom. The same window with selection of the Size tab is shown inFigure 2.7b, which may be used to adjust the size of the object.

4. For a Picture object, the window appears as in Figure 2.7c, and the opportunityto adjust brightness and contrast is offered. If the picture is imported from digital-photo-editing software, these adjustments will probably have already been made.

5. Changing the position, filling colors, or line color may also be accomplished bychoosing the appropriate tab.

2.8 Formatting Objects in Excel

Drawing objects and pictures may be altered in size in Excel by dragging the edges tothe desired size or by first activating the object and then clicking FORMAT/AutoShape(Drawing Object) or Picture. For pictures, the window of Figure 2.8a willappear, which allows modification of picture size and adjustment of brightness andcontrast. These latter factors may have already received attention if the picture isimported from digital-photo-editing software. The dialog window for AutoShape isshown in Figure 2.8b, and it too allows for modification of drawing-object size. Thistext box may also be formatted and sized by activating and then clicking FORMAT/Text Box. The dialog window appears as in Figure 2.8c.

7326_C002.fm Page 11 Tuesday, March 7, 2006 6:17 AM

Page 27: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

12

What Every Engineer Should Know About Excel

FIGURE 2.7

7326_C002.fm Page 12 Tuesday, March 7, 2006 6:17 AM

Page 28: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

13

(a)

(b)

FIGURE 2.8

7326_C002.fm Page 13 Tuesday, March 7, 2006 6:17 AM

Page 29: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

14

What Every Engineer Should Know About Excel

2.9 Use of Photo-Editing Software in Word, Including Wrapping

Digital-photo-editing software may be employed to edit digital photos, which can subse-quently be copied to a Word document as shown in Figure 2.9. In Figure 2.9a, the digitalphoto is shown as it was originally recorded. In Figure 2.9b, the photo has been croppedand a texture effect added. In Figure 2.9d, the photo is cropped and adjustments made incontrast and brightness by using the sliders shown in the dialog window of Figure 2.9c.The effects are exaggerated to show in the printing process.

2.10 Copying Cell Formulas: Effect of Relative and Absolute Addresses

Copying a cell formula has different results depending on whether absolute cell referencesare used or not. In cell B4 of Figure 2.10, the formula calls for the square of the value incell F1. The same result is called for in the formula of cell C4. $F$1 is an absolute cellreference to the value in F1, whereas F1 is called a relative cell reference. The results ofcopying these two formulas are shown on the worksheet. When B4 is copied to C8, theformula does not change because of the absolute cell reference $F$1. When C4 is copied,an entirely different set of results can be obtained:

(c)

FIGURE 2.8

7326_C002.fm Page 14 Tuesday, March 7, 2006 6:17 AM

Page 30: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

15

1. When C4 is copied to D8, F1 becomes G5 (1 column to the right, thus F becomesG, and 4 rows down, thus row 1 becomes 5).

2. When C4 is copied to E8, F1 becomes H5 (2 columns to the right, thus F becomesH, and 4 rows down, thus row 1 becomes 5).

3. When C4 is copied to E4, F1 becomes H1 (2 columns to right, thus F becomes H,and the row remains the same, so the row number remains 1).

4. A formula may be copied for successive rows or columns as shown in column A.The formula is clicked, then click EDIT/COPY, and then the cell is dragged downfor the desired number of rows, followed by pressing Enter. Note how the formularetains the absolute reference but changes the relative cell locations.

5. Moving a formula does not change the cell addresses in the formula. See “Moving,Formulas” under Help/Index for details.

FIGURE 2.9

7326_C002.fm Page 15 Tuesday, March 7, 2006 6:17 AM

Page 31: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

16

What Every Engineer Should Know About Excel

2.11 Copying Formulas by Dragging the Fill Handle

Many engineering situations arise in which tabulation or plots of a function are neededfor uniform increments in the argument of the function. This operation is very easy toperform in Excel by using the Fill Handle and dragging. In Figure 2.11 we show how thisis accomplished for the simple function y = x

2

in increments of

Δ

x = 0.1 over the range 1< x < 2.

The start of the range for x is entered in cell A4 as 1. Then, the next value of x is enteredin cell A5 as 1.1. Cells A4 and A5 are activated, producing the situation shown in Figure2.11a. Then, the Fill Handle is clicked and dragged down for the desired number ofincrements, producing the result shown in Figure 2.11b.

The formula for x

2

is entered in cell B4 as shown in Figure 2.11a. This cell is activatedand the Fill Handle dragged down to copy the formula as shown in Figure 2.11b. In thisfigure, all the formulas are retained in view by clicking TOOLS/OPTIONS/VIEW/For-mulas. Removing the check from the Formulas box produces the final numerical resultsshown in Figure 2.11c.

Display of the formulas is not necessary in the drag process, andthe result in Figure 2.11c can be produced by drag-copying cell B4 while in the numericaldisplay mode.

Copying of cell formulas could also be accomplished by activating the cell, clickingEDIT/COPY, and then dragging for the number of cells desired, followed by Enter. Theuse of the Fill Handle is easier.

Graphs of the functions may be constructed as described in Chapter 3.

2.12 Shortcut for Changing the Status of Cell Addresses

The F4 key may be used to quickly change the absolute or relative status of a cell address.The procedure as applied to the formula in cell B4 of Figure 2.11 is as follows:

FIGURE 2.10

12345678910111213141516

A B C D E

=$F$1*(4.2*B1^2-5.6*C1)=$F$1*(4.2*B2^2-5.6*C2)=$F$1*(4.2*B3^2-5.6*C3) =$F$1^2 =F1^2 =H1^2=$F$1*(4.2*B4^2-5.6*C4)=$F$1*(4.2*B5^2-5.6*C5)=$F$1*(4.2*B6^2-5.6*C6)=$F$1*(4.2*B7^2-5.6*C7) =$F$1^2 =G5^2 =H5^2=$F$1*(4.2*B8^2-5.6*C8)

12

3

4. Formula copied formultiple rows bydragging

7326_C002.fm Page 16 Tuesday, March 7, 2006 6:17 AM

Page 32: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

17

1. Activate cell B4 containing the formula.2. Activate the A4 cell reference in the formula.3. Press the F4 key until the desired type of cell reference is obtained. Repeated

pressing of the F4 key will cycle through the four possible cell references as A4,$A4, A$4, and $A$4.

4. Press Enter.

2.13 Switching and Copying Columns or Rows, and Changing Rows to Columns or Columns to Rows

Sometimes the position of data in a column or row needs to be switched in order to providefor a different orientation on a chart. When using x-y scatter graphs (Section 3.3), Exceltreats the left column or top row of data as the x or abscissa coordinate. The position ofthe column on the worksheet may be changed by copying one of the columns (or rows)to a new location by the following procedure. Pivot tables may also be employed forordering the presentation of data, as described in Section 9.3.

1. Select (activate) the columns or rows of cells to be copied.2. Click EDIT/COPY.3. Click the cell that will be the top cell of the new column or the left cell of the new

row.

FIGURE 2.11

7326_C002.fm Page 17 Tuesday, March 7, 2006 6:17 AM

Page 33: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

18

What Every Engineer Should Know About Excel

4. Click EDIT/PASTE SPECIAL. The window shown in Figure 2.12 will appear.Under Paste, choose Values if new formulas are not to be created. See the earlierdiscussion on relative and absolute cell locations.

5. If a column is to be switched to a row or a row switched to a column, clickTranspose.

6. Click OK.

2.14 Built-In Functions in Excel

Excel has hundreds of built-in functions that may be accessed by the function namefollowed by the syntax that applies to that function. The reader who needs to apply thesefunctions in worksheet formulas will usually be aware of the abbreviations assigned tothe functions.

For a listing of functions, consult Help and obtain further details by entering such itemsas the following:

Engineering functionsMath and trigonometry functionsStatistical functions

Or, for business users,

Financial functions

For later reference, the user may wish to print out the lists of functions. A completedescription of each function can be called up by the function name from Help, which will

FIGURE 2.12

7326_C002.fm Page 18 Tuesday, March 7, 2006 6:17 AM

Page 34: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

19

display all syntax requirements. Some examples are given in Table 2.1. Financial functionsare discussed in Chapter 7.

2.15 Creating Single-Variable Tables Using the DATA/TABLE Command

Copying formulas in successive cells is one way to create a data table as described inSection 2.11. An alternative, and sometimes simpler, procedure makes use of the DATA/TABLE command with the following steps:

TABLE 2.1

Abbreviated List of Built-In Functions

Function Syntax Arguments

Absolute value ABS(x) x = real numberArccosine ACOS(x)

1 < x < + 1, returns

−π

/2 to

π

/2Hyperbolic arccosine ACOSH(x) x = numberArcsine ASIN(x)

1 < x < + 1, returns

−π

/2 to

π

/2Hyperbolic arcsine ASINH(x) x = numberArctangent ATAN(x) x = number, returns

−π

/2 to

π

/2Hyperbolic arctangent ATANH(x)

1 < x < + 1Bessel Function J

n

(x) BESSELJ(n,x) n = order(integer), x = numberBessel function Y

n

(x) BESSELY(n,x) n = order(integer), x = numberCosine COS(x) x = angle in radiansHyperbolic cosine COSH(x) x = numberError function ERF(x) x

0, returns value of 0 to 1.0Exponential EXP(x) x = number, returns e

x

Natural logarithm LN(x) x > 0Logarithm to base b LOG(x,b) x > 0, b = base (default b = 10)Logarithm to base 10 LOG10(x) x > 0Matrix inversion MINVERSE See Section 5.5Matrix multiplication MMULT See Section 5.5Pi PI( ) Returns numerical value of

π

Sine SIN(x) x = angle in radiansHyperbolic sine SINH(x) x = numberSquare root (positive) SQRT(x) x

0Square root of Pi SQRTPI Returns

π

1/2

Summation SUM(x

1

,x

2

, … 30 values) Sum of 30 values or arraySum of squares SUMSQ(x

1

,x

2

, … 30 values, or array) Sum of squares of 30 values or array

Tangent TAN(x) x = angle in radiansHyperbolic tangent TANH(x) x = numberArithmetic average AVERAGE(x

1

,x

2

, … 30 values) Average of 30 values or arraySum of squares of deviations from arithmetic mean

DEVSQ(x

1

,x

2

, … 30 values, or array) =

(x

i

x

mean

)

2

x

mean

= arithmetic meanMaximum, median, or minimum

MAX( ), MEDIAN( ) orMIN(x

1

, x

2

, … 30 values)Returns values for 30 values or array

Normal distributions NORMDIST, NORMINV, NORMSDIST, NORMSINV

See Section 6.5

R-squared RSQ See Section 3.8Sample standard deviation STDEV(x

1

,x

2

, … 30 values) Returns sample standard deviation of 30 values or array

Population standard deviation STDEVP(x

1

,x

2

, … 30 values) Returns population standard deviation of 30 values or array.

Financial functions See Chapter 7

7326_C002.fm Page 19 Tuesday, March 7, 2006 6:17 AM

Page 35: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

20

What Every Engineer Should Know About Excel

1. Set aside rows or columns in a worksheet for labeling variables.2. Choose a column to contain the numerical values of the input variables. Insert

input values in this column. Increments may be set as described in Section 2.11or by direct entry.

3. Type the formula to be calculated in the column to the right of the column in step2 and one row above. The formula should be written in terms of an

input cell

thatis located apart from the body of cells that will house the final table. Selection ofthe input cell is rather arbitrary. The only requirement is that it must be locatedoutside the cell range assigned for the table.

4. Select (activate) cells containing values of the input variable, formula to be eval-uated, and cells that will contain the results.

5. Click DATA/TABLE.6. Enter the input cell location for a column table in the dialog window.7. Click OK. The table will appear.8. If additional result functions need to be evaluated, enter the formulas for each in

the cells adjacent to the formulas in step 3, and repeat steps 5 through 7.9. The procedure may also be executed using rows for data input. In this case,

the formulas are typed in the column to the left of the initial value and one cellbelow.

Example 2.1: Construction of Table for Simple Functions of a Single Variable

We will construct a table for the following three functions of x over the range 0 < x < 5in increments of 1.0:

y

1

= x + 1

y

2

= x + 2

y

3

= x + 3

The worksheet is shown in Figure 2.13. Cell A2 is used for the x label. The three formulasfor the functions are listed in cells B2, B3, and B4, respectively, and the cell range to housethe table is A2:D7. An input cell apart from this region is chosen as F2 and the formulaswritten in terms of this cell as shown in Figure 2.13a. The formulas are displayed on theworksheet by clicking TOOLS/OPTIONS/VIEW/Formulas. The table area is selected asshown in Figure 2.13b and DATA/TABLE clicked, producing the window shown at Figure2.13c. Input column cell F2 is inserted in this window and OK is clicked. The final formulatable also appears as shown in Figure 2.13b. Removing the formulas from view producesthe final table as shown in Figure 2.13d.

A scatter chart of the data table may be constructed using Chart Wizard and will appearas shown below the table in Figure 2.13d. Appropriate titles and nomenclature may beadded to the final data table and chart as desired.

7326_C002.fm Page 20 Tuesday, March 7, 2006 6:17 AM

Page 36: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

21

2.16 Creating Two-Variable Tables Using the DATA/TABLE Command

Two-variable tables may be constructed with a procedure similar to that employed forone-variable tables. Two examples of formulas involving two input variables are:

z = (x

2

+ y

2

)

1/2

and

z = (x + 1)(y + 2)

FIGURE 2.13

7326_C002.fm Page 21 Tuesday, March 7, 2006 6:17 AM

Page 37: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

22

What Every Engineer Should Know About Excel

The procedure for creating the data table is as follows:

1. Select

two input cells

apart from the block of cells that will house the data table.These cells will serve as the variables in the formulas.

2. Choose a cell on the worksheet and enter the formula for the function in termsof the two input cells.

3. Enter a list of input values for one variable in the same column as the formula,but below the formula.

4. Enter a list of input values for the second variable in the same row containing theformula, but to the right of the formula.

5. Select (click and drag) the range of cells that are to contain the formula, inputvalues of both variables, and data table.

6. Click DATA/TABLE.7. The dialog window will appear. Enter the row and column input cells used in

writing the formula in step 2 and those corresponding to the input values enteredin steps 3 and 4.

8. Click OK. The table will appear.

Example 2.2: Two-Variable Data Table

To illustrate the method, we will construct a data table for the function:

z = (x

2

+ y

2

)

1/2

for 1 < x < 5 and 1 < y < 5

(d)

FIGURE 2.13

456789101112131415161718192021222324

A B C D E F2 3 4 53 4 5 64 5 6 75 6 7 8

0

1

2

3

4

5

6

7

8

9

0 1 2 3 4 5

7326_C002.fm Page 22 Tuesday, March 7, 2006 6:17 AM

Page 38: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

23

Increments of x and y are chosen as 1.0. The worksheet is set up as shown in Figure

2.14. Cells A1 and A2 are chosen as input cells for x and y, respectively, and the formulafor z is written in cell C3 as shown in Figure 2.14a. The C column is chosen for x, withthe five input values entered. Likewise, row 3 is chosen for y, with 5 corresponding inputvalues. Smaller or larger increments in x and y could be chosen and entered either directlyor as described in Section 2.11.

Next, the table range C3:H8 is selected by click-dragging. DATA/TABLE is clicked andA1 entered as the input cell for y along with cell A2 as the input cell for x. The entries areshown in the window of Figure 2.14b. OK is clicked and the data table appears as shownin Figure 2.14c, with the formulas displayed. Removal of the formulas gives the final tableshown in Figure 2.15.

A 3-D wire surface chart of the function is displayed below the final data table. Boththe final table and chart may be titled and formatted as needed for the final presentation.

FIGURE 2.14

7326_C002.fm Page 23 Tuesday, March 7, 2006 6:17 AM

Page 39: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

24

What Every Engineer Should Know About Excel

Problems

2.1. In Excel, click TOOLS/OPTIONS. Copy the Options window to a Word documentby pressing Alt + Print Screen, then opening a new Word document, followed byEDIT/PASTE. Adjust size of inserted window by clicking FORMAT/OBJECT/SIZE. Move the window to new positions by pressing cursor arrows or by drag-ging.

2.2. Customize the keyboard in Word as shown in Section 2.3 and type the followingequations:

A = x

0

/{[1

(

ω

/

ω

n

)

2

] + [2(

ω

/

ω

n

)(c/c

c)]2

}

1/2

θ

/

θ

= e

(hA/

ρ

cV)

τ

2.3. Open a new Excel worksheet. Type in a few comments or equations. Change thefont for the worksheet to a different type and size (make your own selections).

FIGURE 2.15

123456789

101112131415161718192021222324252627

C D E F

1 1.414214 2.236068 3.162278 4.123106 5.099022 2.236068 2.828427 3.605551 4.472136 5.3851653 3.162278 3.605551 4.242641 5 5.8309524 4.123106 4.472136 5 5.656854 6.4031245 5.09902 5.385165 5.830952 6.403124 7.071068

1 2 3 4 5S1

S3

S5

0

2

4

6

8

7326_C002.fm Page 24 Tuesday, March 7, 2006 6:17 AM

Page 40: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Miscellaneous Operations in Excel and Word

25

2.4. If convenient to do so, insert a digital photo obtained either from a digital cameraor scanner into a Word and Excel sheet. Edit the photo using photo-editing soft-ware available to you

2.5. Perform the copying operations shown in Figure 2.10.2.6. Perform the drag-copying process shown in Figure 2.11.2.7. Open an Excel worksheet and evaluate the following functions:

e

0.5

Cosh(2.3)

Tanh

1

(0.5)

Numerical value of

π

2.8. Using the DATA/TABLE command, construct a table of values of the functionsin(nx) for n = 1, 2, and 3 and x = 1 to 1.5. Choose appropriate increments in xfor the calculations.

2.9. Using the DATA/TABLE command, construct a table of the three functions

y = x

1/2

y = x + 0.3

y = x

2

over the range 0 < x < 5.2.10. Using the DATA/TABLE command, construct a table of the Bessel function J(n,x)

for n = 1, 2, 3 and 0 < x < 3. Choose increments in x as desired.2.11. Using the EDIT/COPY command, transpose the x-y column data in columns A

and B into the row data shown:

2.12. Enter the following values in an Excel worksheet:

1, 1.2, 1.1, 1.05, 0.96, 0.95, 1.06, 1.15, 1.21, 0.94, 1.01

and using built-in functions evaluate:

y = {[

(x – x

m

)

2

]/n}

1/2

12

3456

A B C D E F G H Ix y x 1 2 3

1 2 y 2 3 4

2 33 44 55 6

7326_C002.fm Page 25 Tuesday, March 7, 2006 6:17 AM

Page 41: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

26

What Every Engineer Should Know About Excel

where

x

m

= (

∑x)/n and n = number of values

2.13. Compare the result of Problem 2.12 with the application of the worksheet functionsSTDEV and STDEVP to the data points.

7326_C002.fm Page 26 Tuesday, March 7, 2006 6:17 AM

Page 42: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

27

3

Charts and Graphs

3.1 Introduction

The preparation, publication, and presentation of graphs and charts represent a significantportion of engineering practice. In Excel, a majority of such displays are given the desig-nation of x-y scatter graphs. For this reason, we will concentrate our discussion on thattype of graphical presentation. Bar graphs and column graphs are discussed briefly inSection 3.19, and surface (3-D) charts are discussed in Section 3.21. Obviously, the inter-ested reader may explore these other graphical possibilities.

The display and discussion in Section 3.3 categorizes the five types of scatter graphsavailable in Excel, along with a general statement of an application for each type. Examplesof data presentations using scatter charts are given in this chapter as well as in theapplication sections of other chapters. Treatment of math and other symbols in graphicaldisplays is discussed in this chapter and in sections of Chapter 4 connected with embeddeddrawing objects. An important part of the present chapter is concerned with the displayand correlation of data using trendlines and the built-in least-squares analysis features ofExcel. Examples are given for correlation equations using linear, power, and exponentialfunctions.

Section 3.20 discusses formatting and cosmetic adjustments that are available for thevarious graphs, and Section 3.22 offers a suggestion for default settings of scatter graphs,which are normally the most common type of display.

As we have mentioned before, many of the sections are essentially self-contained andcan be studied as stand-alone items. To provide for this capability, charts in some sectionshave been embedded with text along with a reduction in type size. As appropriate, cross-references are made to related sections of this and other chapters.

3.2 Moving Dialog Windows

A brief set of data is shown in the screen of Figure 3.1a. INSERT/CHART is clicked,producing the Chart Wizard dialog box shown in Figure 3.1b. The dialog box obscuresthe data, but may be moved out of the way by clicking on the title bar and dragging it toa new position as shown in Figure 3.1c.

7326_C003.fm Page 27 Tuesday, March 7, 2006 6:17 AM

Page 43: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

28

What Every Engineer Should Know About Excel

3.3 Excel Chart Wizard Window Showing Choice of x-y Scatter Charts

Different data series may be designated by various shape or styles of data markers, asshown in Figure 3.2:

1. Data plotted with data markers but no connecting line segments: this type of plotis employed for experimental data with considerable scatter but may be fittedwith a computed trendline.

2. Data plotted with the data markers connected by smoothed lines as determinedby the computer: this type of plot is employed for either calculated points orexperimental data with rather smooth variations from point to point.

3. Data plotted as in item 2 but without data markers: this type of plot is mostfrequently employed for calculated curves and is almost never used for presen-tation of experimental data because the data points are not displayed.

FIGURE 3.1

7326_C003.fm Page 28 Tuesday, March 7, 2006 6:17 AM

Page 44: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

29

4. Data points plotted without markers but with points connected by straight linesegments: this type of plot is frequently used when points are obtained from anumerical analysis that assumes linear behavior between calculated points.

5. The same as item 4, but with points designated by data markers: this type of plotis sometimes employed for calibration curves in which linear interpolationbetween data points is assumed.

3.4 Selecting and Adding Data for x-y Scatter Charts

In setting up scatter charts, the x-axis will be either the left column or top row of data,depending on whether columns or rows are chosen for the data series. The y-axis will bethe remaining columns or rows. After the chart is established, the addition of data willbe as new y-axes regardless of their location relative to the column or row taken as the x-axis. The data selection procedure is as follows:

1. Click-drag cells for the x-axis while holding down the Ctrl button.

FIGURE 3.2

7326_C003.fm Page 29 Tuesday, March 7, 2006 6:17 AM

Page 45: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

30

What Every Engineer Should Know About Excel

2. Release click on the mouse, move the pointer to the column for the first y-axisdata while still holding down the Ctrl button and then click-drag cells for the firsty-axis data.

3. Continue this procedure for successive y-axes data, still holding down the Ctrlbutton.

3.5 Changing and Adding Data for Charts Using the SOURCE DATA Command

Data for charts can be added or changed as follows:

1. Activate the chart. For a separate chart sheet, click the tab for the chart sheet.2. Click CHART/SOURCE DATA.3. Select the worksheet containing data to be added.4. To view worksheet cells and data, click the collapse button at the right end of

DATA RANGE dialog box as shown on the screen.5. Select the

replacement

data cells to be added as described in Section 3.4. Thesereplacement cells may be chosen to include or omit the old data cells. To simplyadd a data series while retaining the old data, see the description of the ADDDATA command in Section 3.6.

6. Click the collapse (expand) button (see Figure 3.3) again at right end of the dialogbox displayed at top of worksheet. The SOURCE DATA dialog box will reappear.

7. Click OK, which will install the new replacement data on the chart.8. Make cosmetic and other adjustments to the chart as needed.

3.6 Adding Data to Charts Using the ADD DATA Command

Data can be added to charts as follows:

1. Activate the chart. For a separate chart sheet, click the tab for the chart sheet.2. Click CHART/ADD DATA.3. Select the worksheet containing data to be added.4. If the ADD DATA dialog box obscures the view of data, click the collapse button

at the right end of DATA RANGE text box or drag the dialog box into a newlocation away from the data columns.

5. Select the data cells to be added as the new y-axis data by clicking and draggingas described in Section 3.4.

6. Click the collapse (expand) button again at right end of the dialog box. The ADDDATA dialog box will reappear.

7326_C003.fm Page 30 Tuesday, March 7, 2006 6:17 AM

Page 46: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

31

7. Click OK, which will install new data on the chart. Note that if a replacement ofall the chart data is desired, the procedure using the SOURCE DATA commandis followed.

8. Make cosmetic and other adjustments to the chart as needed.

3.7 Adding Trendlines and Correlation Equations to Scatter Charts

Click on the chart to activate it. Then click CHART/ADD TRENDLINE/TYPE/select thetype of trendline. Then, click the OPTIONS tab to select Display Equation on Chart andR-squared. Adjust the location, size, and font of the equation and R

2

on the chart as needed.See Section 3.9 and Section 3.10 for specific examples.

3.8 Equation for R

2

The equation employed by Excel for calculation of R

2

in the trendline fits is given by

R

2

= [n

x

i

y

i

(

x

i

)(

y

i

)]

2

/[n

x

i2

(

x

i

)

2

][n

y

i2

(

y

i

)

2

] (3.1)

FIGURE 3.3

7326_C003.fm Page 31 Tuesday, March 7, 2006 6:17 AM

Page 47: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

32

What Every Engineer Should Know About Excel

R

2

is called the coefficient of determination, whereas R is called the correlation coefficient.This particular equation expresses what is called the Pearson correlation coefficient, whichis callable by the PEARSON worksheet function. A calculation of R

2

separate from thetrendline determinations may also be obtained by calling either the worksheet functionRSQ or PEARSON. See Help/Index for the proper syntax for execution of these functions.The R

2

displayed with the graphical trendline is expressed by

where SSE is the sum of the squares of the error from the correlating trendline, or

SSE =

(y

i

y

ic

)

2

and SST is the sum of squares of deviations from the arithmetic mean, y

mean

= (

y

i

)/n,and may be expressed in the form

SST = (

y

i2

)

(

y

i

)

2

/n

where y

ic

represents the value of y on the linear trendline fit. For a perfect match betweendata points y

i

and the trendline, R

2

= 1.0. For exponential, power, and polynomialtrendlines Excel uses a transformed regression model. Note that these calculations areequivalent to using a population standard deviation instead of a sample standard devia-tion. Still, a perfect fit will be obtained when y

i

= y

ic

. SST may also be calculated in termsof the population standard deviation function STDEVP through the relation

SST = n

×

[STDEVP(y

i

)]

2

3.9 Correlation of Experimental Data with Power Relation

A number of physical phenomena follow a power law relation between variables. Exam-ples are

Nu = CRe

n

for forced convection and

Nu = C(GrPr)

m

for free convection heat transfer. The general power law relation has the form

y = ax

b

(3.2)

Taking the logarithm of both sides of the equation gives

Log y = Log a + bLog x (3.3)

RSSESST

2 = −1

7326_C003.fm Page 32 Tuesday, March 7, 2006 6:17 AM

Page 48: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

33

which is a linear relation between Log y and Log x. When x and y are plotted on a log–loggraph, b will be the slope of the line and Log a will be the intercept at x = 1.0 (see Section3.10). When trying to fit experimental data with the power law relation, scatter in the datawill normally occur and a least-squares analysis should be employed to determine thebest fit. A correlation coefficient may also be calculated to indicate the goodness of fit.

Excel may be used to (1) display the data on a log–log plot, (2) calculate the values ofthe constants a and b using a least-squares analysis, (3) display the resultant correlationtrendline, and (4) display the correlation equations on the plot.

The Excel procedure is as follows:

1. List the data in two columns. Label columns as appropriate. Consider discardingany data points that appear to be in gross error. This step may be deferred untilafter the data plot is obtained. See step 7.

2. Select the data to be plotted.3. Click Chart Wizard or INSERT/CHART.

a. Select the scatter chart

without

connecting line segments (type 1 chart).b. Select the data range of cells.c. Input the chart title and values for x- and y-axes. Under AXES click values for

both x and y. Under GRIDLINES, select as appropriate. Under DATA LABELS,None is probably appropriate.

d. Click FINISH. The chart will appear.4. Click the chart to be edited. Click either x- or y-value axis — FORMAT AXIS will

appear. Under SCALE, click Logarithmic Scale. Select the minimum and maximumvalues for the scale (nonzero values for log scale) and the value for crossing theother axes. Repeat for other value axes. Then repeat FORMAT AXIS/PATTERNSto set tick marks for both major and minor axes, with labels next to the axis. FONTmay also be adjusted at this point if desired.

5. After step 4 is completed, click the chart again. Then click CHART/ADDTRENDLINE/TYPE/POWER. Click OK. Then click the chart again, followed byCHART/ADD TRENDLINE/OPTIONS, and click Display Equation on Chart andDisplay R-squared Value on Chart. Click OK.

6. Inspect the final graph. Does the trendline appear to represent the data? If not,the power relation may not be correct for the physical application.

This step isimportant! A correlation equation should NEVER be accepted without visual confirmationof agreement with the experimental data points

. The computer will perform thetrendline analysis as instructed, but cannot assure that the functional form selectedis correct.

7. Examine the individual data points in the final plot. If some points appear to bewidely scattered from the main body of data, consult the original data sheets forpossible errors or erratic behavior in the experiment. Consider eliminating suspi-cious points.

8. If a decision is made to eliminate points as discussed in step 7, delete the respectiveentries in the data cells. The deletions will appear on the chart, and a new trendlineand correlation equation will be displayed, based on the remaining data points.

9. Make final adjustments to the cosmetics of the chart, fonts, titles, etc. If a largenumber of data points are involved, some adjustment of the size of data markersor line width for the trendline may be in order.

7326_C003.fm Page 33 Tuesday, March 7, 2006 6:17 AM

Page 49: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

34

What Every Engineer Should Know About Excel

Two examples of power law correlation plots are shown in Figure 3.4. One has a rathergood fit, whereas the other has a lot of scatter. In the latter case, one should suspect thateither the data are bad or that a power law relation does not fit the physical situation.

3.10 Use of Logarithmic Scales

The data are first plotted on a linear graph as shown in Figure 3.5a, indicating a decayingexponential or inverse power relation. Logarithmic scales are then selected by clicking oneach value axis, then click FORMAT AXIS/SCALE/check Logarithmic scale as shown inthe screen of Figure 3.5b. The result is the graph in Figure 3.5c with the x-axis in aninconvenient position at the top of the graph. The y-axis value is again selected. Thenclick FORMAT AXIS/SCALE as shown in Figure 3.5d. The “Value (X) axis crosses at:” ischanged to 0.01 (the lower edge of the graph), and the result is shown in the graph ofFigure 3.5e. Next, a trendline is added by clicking on the data, then click GRAPH/ADDTRENDLINE/TYPE/highlight Power as shown in the screen of Figure 3.5f. Then, selectthe OPTIONS tab and check “Display equation on chart” and “Display R-squared valueon chart” as shown in the screen of Figure 3.5h. The result is the graph in Figure 3.5g. Apower relation does fit the data.

FIGURE 3.4

x y1 1.52 33 54 155 276 347 48

y = 1.0554x 1.8929

R2 = 0.9498

1

10

100

0

x y1 202 63 564 255 426 127 878 99

y = 11.103x 0.7598

R2 = 0.299

1

10

100

0

(a)

(b)

7326_C003.fm Page 34 Tuesday, March 7, 2006 6:17 AM

Page 50: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

35

3.11 Correlation with Exponential Functions

The exponential function y = exp(

0.1x) is tabulated and shown first as a linear plot inFigure 3.6a with a linear trendline fit, which obviously does not fit. Second, a linear plotwith exponential trendline fit is shown in Figure 3.6b with perfect correlation. Third, thefunction is plotted on a semilog graph that displays the function as a straight line in Figure3.6c. Again, an exponential trendline is fitted with perfect correlation. Inspection of thevisual display is needed to evaluate the trendline fit. For comparison, the final two plotsof Figure 3.6d and Figure 3.6e show fits of second- and third-degree polynomials. The

FIGURE 3.5

7326_C003.fm Page 35 Tuesday, March 7, 2006 6:17 AM

Page 51: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

36

What Every Engineer Should Know About Excel

third-degree one shows a perfect correlation. Polynomials may frequently be employedto obtain a good fit when the functional form is uncertain.

3.12 Use of Different Scatter Graphs for the Same Data

Figure 3.7 shows six scatter plots of a set of hypothetical experimental data displayed inthe upper-left corner of the sheet. Figure 3.7a is a type 1 scatter graph, Figure 3.7b is atype 5 chart, and Figure 3.7c is a type 3 chart — all plotted with linear scales on both axes

FIGURE 3.5

(continued)

7326_C003.fm Page 36 Tuesday, March 7, 2006 6:17 AM

Page 52: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

37

(see Section 3.3). Figure 3.7d, Figure 3.7e, and Figure 3.7f are the same types of plots, butwith logarithmic scales on the axes (see Section 3.10). From the graph in Figure 3.7d, itcan be seen that the data fall approximately on a straight line so a power law relationmight be anticipated, and the corresponding trendline inserted as shown along with thecorrelation equation and value of R

2

(see Section 3.9).Inspecting the data plot in Figure 3.8a, four points are circled as shown in Figure 3.8a

along with the first data point indicated by the arrow shown in Figure 3.8d of that page.These points appear out of place and are, hence, suspect. The first data point looksparticularly odd. If these five points are eliminated as shown in Figure 3.9, a much bettercorrelation results.

FIGURE 3.6

(a c)

exp(-0.1x)1

0.9048374

0.8187308

0.7408182

0.67032

0.6065307

0.5488116

0.4965853

0.449329

0.4065697

0.3678794

0.3328711

0.3011942

0.2231302

0.1353353

Linear Chart-Linear Trendline

y = -0.0443x+ 0.8674

R2 = 0.9194

0

0.2

0.4

0.6

0.8

1

1.2

0 5 10 15 20 25x

y=exp(-0.1x)

Semi-Log Chart-Exponential Trendline

y = e -0.1x

R2 = 1

0.1

1

0 5 10 15 20 25

x

y=exp(0.1x)

(b)

Linear Chart-Exponential Trendline

y = e -0.1x

R2 = 1

0

0.2

0.4

0.6

0.8

1

1.2

0 5 10 15 20 25x

y=exp(-0.1x)

(d e)

Second Degree Polynomial

y = 0.002x 2 - 0.0818x+ 0.9777

R2 = 0.9978

0

0.2

0.40.6

0.8

11.2

0 5 10 15 20 25

x

y=exp(-0.1x)

Third Degree Polynomial

y = -7E-05x 3 + 0.004x 2 - 0.0965x+ 0.9977

R2 = 1

00.2

0.4

0.60.8

1

1.2

0 5 10 15 20 25

x

y=exp(-0.1x)

7326_C003.fm Page 37 Tuesday, March 7, 2006 6:17 AM

Page 53: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

38

What Every Engineer Should Know About Excel

FIGURE 3.7

(a)

x y1 0.1

1.2 1.41.3 1.51.5 2.51.6 2

2 4.22.1 4.12.4 152.9 73.1 9.63.5 11.23.7 254.1 154.2 14.95.3 265.4 25.35.9 216.3 29

7 657.2 527.6 658.1 72

0

10

20

30

40

50

60

70

80

0 2 4 6 8 10

(d

y = 0.6523x 2.2761

R2

= 0.881

0.1

1

10

100

0

0

10

20

30

40

50

60

70

80

0 2 4 6

(b

0

c)

0

10

20

30

40

50

60

70

80

0 2 4 6 0

e)

0.1

0.1

1

10

100

1 10

(f)

1

10

100

0

7326_C003.fm Page 38 Tuesday, March 7, 2006 6:17 AM

Page 54: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

39

FIGURE 3.8

b)

0

10

20

30

40

50

60

70

80

0 2 4 6 0

e)

0.1

1

10

100

0

x y

1 0.11.2 1.41.3 1.51.5 2.51.6 2

2 4.22.1 4.12.4 152.9 73.1 9.63.5 11.23.7 254.1 154.2 14.95.3 265.4 25.35.9 216.3 29

7 657.2 527.6 658.1 72

(a

0

10

20

30

40

50

60

70

80

0 2 4 6 8 10

(d

0.1

1

10

100

0

(c)

0

10

20

30

40

50

60

70

80

0 2 4 6 8 10

(f)

0.1

1

10

100

0

7326_C003.fm Page 39 Tuesday, March 7, 2006 6:17 AM

Page 55: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

40

What Every Engineer Should Know About Excel

FIGURE 3.9

0

10

20

30

40

50

60

70

80

0 2 4 6 8 10

(e)

0.1

1

10

100

0

x y0.1

1.2 1.41.3 1.51.5 2.51.6 2

2 4.22.1 4.1

152.9 73.1 9.63.5 11.2

254.1 154.2 14.95.3 265.4 25.3

216.3 29

657.2 527.6 658.1 72

0

10

20

30

40

50

60

70

80

0 2 4 6 8 10

0

10

20

30

40

50

60

70

80

0 2 4 6 0

(f)

0.1

1

10

100

0

(d)

7326_C003.fm Page 40 Tuesday, March 7, 2006 6:17 AM

Page 56: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

41

3.12.1 Observations

The charts in Figure 3.7c and Figure 3.7f do not convey much information about the dataand do not give a reader any hint of what might be going on with the experiment. Lookingat the other charts would certainly not give one the impression of a smooth variation ofy as a function of x. The charts in Figure 3.7b and Figure 3.7e are somewhat better, butthose in Figure 3.7a and Figure 3.7d give the best impression of the scatter of data. Thechart in Figure 3.7d, because it indicates that the data are approximately on a straight linein a log–log plot, gives the clue that a power relation may apply if one deletes the firstdata point, which appears totally skewed. As we have stated before, one should neverleave out the data markers when plotting experimental results. In some other chart exam-ples, involving plots of calculated points, we will see that the use of smooth curves as inFigure 3.9c and Figure 3.9f will be quite appropriate.

3.13 Plot of a Function of Two Variables with Different Chart Types

This example illustrates how it is possible to present the plot of a function or data indifferent chart types to convey somewhat different impressions of the function. The Besselfunction J

n

(x) is chosen for presentation because of its attractive appearance as a dampedsine wave. The function is callable in Excel as BESSELJ(x,n). The worksheet is set up asshown in Figure 3.10, with column A listing the values of the argument x to be incrementedusing Dx selected in cell H3. These increments may be selected as coarse or fine as desired.Columns B through F compute the Bessel functions as a function of the argument x andorders n = 0 to 4. The formulas are copied for as many rows as needed for the plot. InFigure 3.10, the copying is shown for just a few rows. Also shown is a printout of a fewof the numerical values of the functions.

The different types of charts selected for presentation are shown in Figure 3.11a throughFigure 3.11f. The chart in Figure 3.11a is a typical type 3 scatter graph with smooth curves

FIGURE 3.10

1

2

3

4

5

6

7

8

A B C D E F G H

x J(x,0) J(x,1) J(x,2) J(x,3) J(x,4 x

0 =BESSELJ(A3,0) =BESSELJ(A3,1) =BESSELJ(A3,2) =BESSELJ(A3,3) =BESSELJ(A3,4) 0.3

=A3+$H$3 =BESSELJ(A4,0) =BESSELJ(A4,1) =BESSELJ(A4,2) =BESSELJ(A4,3) =BESSELJ(A4,4)=A4+$H$3 =BESSELJ(A5,0) =BESSELJ(A5,1) =BESSELJ(A5,2) =BESSELJ(A5,3) =BESSELJ(A5,4)

=A5+$H$3 =BESSELJ(A6,0) =BESSELJ(A6,1) =BESSELJ(A6,2) =BESSELJ(A6,3) =BESSELJ(A6,4)=A6+$H$3 =BESSELJ(A7,0) =BESSELJ(A7,1) =BESSELJ(A7,2) =BESSELJ(A7,3) =BESSELJ(A7,4)

=A7+$H$3 =BESSELJ(A8,0) =BESSELJ(A8,1) =BESSELJ(A8,2) =BESSELJ(A8,3) =BESSELJ(A8,4)

1

2

3

4

5

6

7

8

9

A B C D E Fx J(x,0) J(x,1) J(x,2) J(x,3) J(x,4) Dx

0 1 0 0 0 0 0.30.3 0.97763 0.14832 0.01117 0.00056 2.1E-050.6 0.912 0.2867 0.04367 0.0044 0.000330.9 0.80752 0.40595 0.09459 0.01443 0.001641.2 0.67113 0.49829 0.15935 0.03287 0.005021.5 0.51183 0.55794 0.23209 0.06096 0.011771.8 0.33999 0.58152 0.30614 0.0988 0.0232

7326_C003.fm Page 41 Tuesday, March 7, 2006 6:17 AM

Page 57: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

42

What Every Engineer Should Know About Excel

FIGURE 3.11

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0 2 4 6 8 10 12 14 16

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53

1 4 7

10 13 16 19 22 25 28 31 34 37 40 43 46 49 52

S1

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

(a) Type 3 x-y scatter chart

(b) Area chart with overlapping

(c) Surface chart, 3-D wire frame surface without color

7326_C003.fm Page 42 Tuesday, March 7, 2006 6:17 AM

Page 58: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

43

connecting the points and no data markers. The chart in Figure 3.11b is an area chartshowing the curves as overlapping with a shading effect.

The chart in Figure 3.11c is a surface chart with a wire frame 3-D surface without color.Charts in Figure 3.11d through Figure 3.11f all involve selection through the sequence ofclicks: CHART/CHART TYPE/AREA/Area with 3-D Visual Effect and then CHART/3-D View/Rotate Vertical. For this presentation, three views were generated as shown inFigure 3.11d to Figure 3.11f. Zero or 360

°

represents a straight-ahead view with no 3-Deffects showing. The charts are generated in different colors but printed in grayscale here.This presentation enables one to look at the “front” or “back” of functions or data. Thewindow for the rotation selection process is also shown in Figure 3.12. Other effects suchas perspective, etc., are also available as indicated in the 3-D View dialog window.

Figure 3.13 provides further illustrations of the results of using different rotation andelevation views for the 3-D display.

FIGURE 3.11

(continued)

FIGURE 3.12

7326_C003.fm Page 43 Tuesday, March 7, 2006 6:17 AM

Page 59: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

44

What Every Engineer Should Know About Excel

3.13.1 Changes in Gap Width and Chart Depth on 3-D Displays

The depth of each of the function displays and the width of the separation gap betweenthem may be adjusted with the following procedure:

1. Activate the data series by clicking on it.2. Click FORMAT/SELECTED DATA SERIES/OPTIONS and make changes in chart

depth and gap width as desired. The Format Data Series window is shown inFigure 3.14.

3.14 Plots of Two Variables with and without Separate Scales

Two sets of data (curves) with either markedly different ranges or units may be plottedas two data series on the same scatter graph. Both the abscissas (x-coordinate) and ordi-nates (y-coordinate) may have different scales or units. The procedure as shown in Figure3.15 is as follows:

FIGURE 3.13

7326_C003.fm Page 44 Tuesday, March 7, 2006 6:17 AM

Page 60: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

45

1. Plot both sets of points using the normal procedure for scatter graphs, as shownin Figure 3.15.

2. Click on the first set of data (series) to cause the Format Data Series box to appear.Click AXES. The primary axes are lower for the abscissa and are to the left for theordinate. Secondary axes are the upper ones for the abscissa and are to the rightfor the ordinate. Select the desired option. The scale of the graph for that serieswill be expanded or contracted and the data replotted accordingly, as shown inFigure 3.15b.

3. Repeat for the other set of data (series) and select the other axes. Again, new scaleswill appear and the points replotted, as shown in Figure 3.15c.

4. Click on each of the four axes and attach titles (labels) of indicated variables andunits, tick marks, etc., as appropriate. The data sets may be marked or titled witha separate legend box, different color lines, or box labels inserted directly on thechart itself. Cosmetic features may be added as necessary. The final result is shownin Figure 3.15d.

3.15 Charts Used for Calculation Purposes or G&A Format

Figure 3.16 shows a type 3 x-y scatter chart for display of computed values of R, the capitalrecovery factor used in financial calculations. The Excel table of values is shown in theupper-part of the worksheet, followed by an equation for R that was composed in Wordand copied to the Excel worksheet. The use of smoothed curves without data markers isobviously a good choice for the presentation in this example.

FIGURE 3.14

7326_C003.fm Page 45 Tuesday, March 7, 2006 6:17 AM

Page 61: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

46

What Every Engineer Should Know About Excel

FIG

UR

E 3.

15

7326_C003.fm Page 46 Tuesday, March 7, 2006 6:17 AM

Page 62: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

47

FIGURE 3.16

I R(5) R(10) R(15) R(20) R(25)0.01 0.206 0.105582 0.072124 0.055415 0.0454070.02 0.2122 0.111327 0.077825 0.061157 0.051220.03 0.2184 0.117231 0.083767 0.067216 0.0574280.04 0.2246 0.123291 0.089941 0.073582 0.0640120.05 0.231 0.129505 0.096342 0.080243 0.0709520.06 0.2374 0.135868 0.102963 0.087185 0.0782270.07 0.2439 0.142378 0.109795 0.094393 0.0858110.08 0.2505 0.149029 0.11683 0.101852 0.0936790.09 0.2571 0.15582 0.124059 0.109546 0.101806

0.1 0.2638 0.162745 0.131474 0.11746 0.1101680.11 0.2706 0.169801 0.139065 0.125576 0.118740.12 0.2774 0.176984 0.146824 0.133879 0.12750.13 0.2843 0.18429 0.154742 0.142354 0.1364260.14 0.2913 0.191714 0.162809 0.150986 0.1454980.15 0.2983 0.199252 0.171017 0.159761 0.1546990.16 0.3054 0.206901 0.179358 0.168667 0.1640130.17 0.3126 0.214657 0.187822 0.17769 0.1734230.18 0.3198 0.222515 0.196403 0.18682 0.1829190.19 0.3271 0.230471 0.205092 0.196045 0.192487

0.2 0.3344 0.238523 0.213882 0.205357 0.202119

R = i/[1 - (1 + i) -n]

n = 5

n =10

n =15

n =20

n =25

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21

Interest Rate, I

R

n =25

n =20

n =15

n =10

n =5

7326_C003.fm Page 47 Tuesday, March 7, 2006 6:17 AM

Page 63: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

48

What Every Engineer Should Know About Excel

3.15.1 G&A Chart

In Figure 3.17 the same information is plotted in what we choose to call a G&A Chart(for Generals and Admirals). Still, a type 3 scatter chart is employed, but large, boldfonts are used for axis and chart labels. Minor gridlines are deleted, and a light patternis added to the body of the chart for cosmetic effects. This might be called a “broadbrush” chart as it shows main trends. It cannot be used for calculation purposes. Onthe other hand, the chart in Figure 3.16 can be used to read rather precise values of R.

3.16 Stretching Out a Chart from a Single Chart Page

A chart that needs to extend broadly from top to bottom or side to side, but which appearscompressed on a single page, can be stretched out by the following:

1. Click EDIT/COPY from chart on chart page.

FIGURE 3.17

CAPITAL RECOVERY FACTOR

0

0.1

0.2

0.3

0.4

0 0.1 0.2

Interest Rate, I

R

0.3

n =25

n = 10

n = 5

7326_C003.fm Page 48 Tuesday, March 7, 2006 6:17 AM

Page 64: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs

49

2. Open a new “sheet.”3. Click upper-left corner cell (A1) of the new sheet or somewhere thereabouts.4. Click EDIT/PASTE.5. Click on the background to “deactivate” the chart.6. Click FILE/PAGE SETUP.7. Choose Adjust To (“% size”) or Fit To. Choose Portrait or Landscape depending

on chart orientation. Note that both % size and Fit To cannot be selected at thesame time. Once % size is chosen, the number of pages is automatically set. Or,when the number of pages is set for the Fit To, the program will first try a setupat 100% size to fit within the number of pages selected. This may not require allthe pages specified. If a fit does not work at 100% size, the program will automat-ically reduce the chart size to fit the number of pages specified. Thus, a widefigure specified at 100% size might require three pages in the portrait format, butonly two pages in the landscape format. If Fit To 2 pages is specified, the programwill automatically reduce the size in the portrait format, while still retaining 100%size in the landscape format. The % size will then appear in the box on the PageSetup dialog screen. Several tries, with the use of Print Preview, may be neededto obtain the desired setup for the final printout. Of course, all these adjustmentsare in addition to those that may be affected by stretching or squeezing the originalchart proportions before or after it is copied to the sheet for these operations.Because of screen viewing limitations, there is only so much that can be conve-niently accomplished on the single chart sheet.

8. Click OK.9. Click FILE/PRINT PREVIEW to see the setup.

10. If desired, comments or labels can be entered in appropriate cells of the new sheetor by using text boxes.

11. This technique may be employed to construct poster-sized charts assembled fromseveral 8

1

/

2

×

11 pages physically pasted together.12. The same effects may be achieved with a printer with built-in poster capabilities.

3.17 Alternate Chart Sizing Procedure Using MS Word

Although the previous procedure is a satisfactory way to accomplish a stretched versionof the chart, a somewhat easier protocol may be exercised by transferring the chart to aMS Word document as a picture (Enhanced Metafile; see Section 4.3). The procedure is asfollows:

1. Activate the chart if it is embedded in a worksheet.2. Click EDIT/COPY after activation or immediately if copying a chart page.3. Open a new MS Word document.4. Click EDIT/PASTE SPECIAL/PICTURE (Enhanced Metafile). The chart will

appear in document form.5. While the chart is activated (if it has become deactivated, click to activate), click

FORMAT/PICTURE/SIZE and make adjustments in size as desired. If the chart

7326_C003.fm Page 49 Tuesday, March 7, 2006 6:17 AM

Page 65: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

50

What Every Engineer Should Know About Excel

(picture) proportions are to be changed, be sure to remove the check from the“Lock aspect ratio” box and adjust the width and length dimensions separately(see Section 2.7). MS Word will automatically adjust the number of pages toaccomplish the final chart size. Further adjustments in the number of pages toaccommodate the chart may be made by changing the page margins by clickingFILE/PAGE LAYOUT/MARGIN and setting larger or smaller margins and head-ers or footers.

6. Periodic checking of FILE/PRINT PREVIEW should be employed to examine thechart appearance before the final process is executed.

7. At the same time the chart size and proportions are adjusted, addition of labels,symbols, or text boxes may be accomplished as discussed in Section 4.3.

3.18 Calculation and Graphing of Moving Averages

Moving averages are employed as forecasting tools in applications ranging from stockmarket predictions to estimations of sales and inventory trends. The calculation assumesthat a forecast value of the variable under consideration may be made as a simple arithmeticaverage of the preceding actual values over a selected number of time periods. The numberof periods is chosen to fit the situation. In many cases, moving averages are charted usingseveral calculation intervals to gain comparative insights into the specific trends.

The formula for the moving average calculation is

F

t

= (1/n) (3.4)

or

F

t+1

= (1/n) (3.5)

whereF

t

= forecast value of the variable at time tn = number of previous time periods over which the average is to be computed (Excel

uses a default value of 3 periods if some other number is not specified)A

t

= actual value of the variable at time t

Thus, for n = 4 time intervals, we would have forecast values at times t = 6 and 7 of

F6 = (A5 + A4 + A3 + A2 )/4

F7 = (A6 + A5 + A4 + A3)/4

Excel performs the calculation for a set of specified At values and presents a graph ofthe forecast values Ft along with the actual values for comparison. It is an easy matter to

At-i

i

n

=∑

1

At 1-i

i 1

n

+=∑

7326_C003.fm Page 50 Tuesday, March 7, 2006 6:17 AM

Page 66: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 51

change the number of periods for the moving average calculation to examine the influenceof this selection on forecasting trends.

Example 3.1: Weather Temperature TrendsFigure 3.18 displays three types of weather temperature data as indicated in the nomen-clature for the figure: (a) TV fifth day future forecasts for high and low temperatures, (b)actual high and low temperatures, and (c) long-term average or normal high and lowtemperatures. We will present results of moving average calculations for 10-, 30-, and 60-d intervals over a 220-d total time period. The calculations will be made for the following:

1. The TV fifth day future forecast for daily high temperature in °F.2. The long-term average high temperature in °F.

The moving average calculation is CALLED by clicking TOOLS/DATA ANALYSIS/Moving average, which results in the display of the Moving Average dialog box as shownin Figure 3.19. Entries are made in this box as described in the following paragraphs.

The input range is specified for the TV forecast data as in column C3:C223. Theseworksheet data are not displayed because of the large number of entries. The first twocells of the column are labels, so the actual data points are in C3:C223. If a label is in thefirst row of the data column selected, that box should be checked. If not, Excel will labelthe variables as Values and the abscissa as Data Point when the graph is displayed. Theabscissa in this case will be labeled Days, and we will insert the proper titles for the graphcoordinates in the editing process. The interval for this problem is 10, 30, or 60 d.

FIGURE 3.18

7326_C003.fm Page 51 Tuesday, March 7, 2006 6:17 AM

Page 67: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

52 What Every Engineer Should Know About Excel

Specifying the upper-left cell of the output table automatically sets the output range forthe forecast values. For the case shown in the dialog box, AD3 is chosen for the 10-daveraging. If the standard error box is checked, a second result column adjacent to theoutput forecast values will be reserved. We will discuss the equation used for the standarderror calculation later in Section 3.18.1.

A chart output should be selected. The chart will appear embedded on the calculationworksheet. In many cases, this chart will require considerable editing to bring it to accept-able visual proportions. The chart will contain plots of both the actual values At given inthe specified data column and the computed forecast values Ft. The forecast plot will notstart until t equals the interval value.

Figure 3.20 and Figure 3.21 show the 10- and 30-d moving averages for the TV forecastdata. Clearly, the 10-d average follows the actual data more closely than the 30-d average.The actual temperature rises through spring and summer, and the moving average lagsthis advance, with the lag increasing as the averaging interval is increased. If the processwere carried into the fall and winter season, we would find that the moving averageswould still lag the actual temperatures and, thus, fall above the actual temperatures onthe chart.

Figure 3.22 presents 10-, 30-, and 60-d moving averages for the long-term averagenormal high temperatures, along with the actual temperature values upon which theaveraging calculations were based. The jagged nature of the actual temperature curveresults from data rounded to the nearest degree. It should be a smooth curve. The

FIGURE 3.19

7326_C003.fm Page 52 Tuesday, March 7, 2006 6:17 AM

Page 68: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 53

FIGURE 3.20

FIGURE 3.21

Ten Day Moving Average

50

60

70

80

90

100

110

0 50 100 150 200 250

Day

For

ecas

tH

iTem

pera

ture

Actual Forecast

Thirty Day Moving Average

50

60

70

80

90

100

110

0 50 100 150 200 250

Day

For

ecas

tH

iT

emp

erat

ure

Actual Forecast

7326_C003.fm Page 53 Tuesday, March 7, 2006 6:17 AM

Page 69: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

54 What Every Engineer Should Know About Excel

moving average curves exhibit the lag behavior shown previously for the forecasttemperatures in Figure 3.20 and Figure 3.21. The larger the number of time intervals,the greater the lag.

Some stock market enthusiasts claim that when the charted price of a stock breaksthrough a 30- or 60-d moving average, the future trend will be in the direction of thebreakthrough. If the stock breaks on the upside, it should be bought. If it breaks onthe downside it should be sold or shorted. Reliable data on this effect are difficult toobtain.

3.18.1 Standard Error

The standard error for the moving average function is defined by:

S(t +1) = {∑[(At+1-I - Ft+1-I)2/n]}1/2 (3.6)

This function has the same form as a population standard deviation.The standard error for the 10-d moving average of Figure 3.20 is plotted in Figure 3.23.

The decreasing trend with the approach of summer indicates less volatility in temperatureas the calendar progresses. This just means that Texas is predictably hot in the summer— day after day.

FIGURE 3.22

50

55

60

65

70

75

80

85

90

95

100

0 50 100 150 200 250

Days

Mov

ing

Ave

rage

Normal Hi Temperature

Ten Day Avg

Thirty Day Avg

7326_C003.fm Page 54 Tuesday, March 7, 2006 6:17 AM

Page 70: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 55

3.19 Bar and Column Charts

Although not as widely used as scatter charts, bar and column charts have a numberof applications in engineering and are rather straightforward to create in Excel. The dataare simply activated and the appropriate bar or column chart selected with Chart Wizard.Editing with choices of fonts, fill patterns, line widths, etc., is essentially the same aswith any other chart, but the editing of gap widths and depths between columnsdeserves some special mention. To perform this editing, in either 2-D or 3-D bar orcolumn charts, the data series are first activated by double-clicking on the chart. TheFormat Data Series window will then appear as shown in Figure 3.24 for a 2-D chart orFigure 3.25 for a 3-D chart. In either case, the OPTIONS tab should be selected.

For a 2-D bar or column chart, Gap width is the spacing between the bars representingeach data point. Overlap indicates the spacing between the adjacent data points. NegativeOverlap indicates a space between the columns. Figure 3.24 illustrates the results ofchanging both parameters for a simple data system.

In a 3-D bar or column chart, the parameters of Gap depth, Gap width, and Chart depthmay be varied to change the appearance of the final chart presentation. Figure 3.25 illustratesthe Format Data Series/Options window for a 3-D chart along with a sketch defining therespective terms. Figure 3.26 shows variations of a 3-D chart for the same simple data setas before. In Figure 3.26a the default chart corresponds to the Format Data Series windowin Figure 3.25. In Figure 3.26b the gap width has been increased, which produces a corre-sponding narrowing of the column widths (overall chart width remains constant). In Figure3.26c the chart depth has been increased, producing a corresponding increase in the depthof the columns. Finally, in Figure 3.26d the gap depth has been increased, and this actionresults in a thinning of the individual column depths. Of course, a combination of all threeadjustments may be made to achieve the desired final presentation.

FIGURE 3.23

0

2

4

6

8

10

0 50 100 150 200 250

Days

S(t+

1)

Standard Error for Ten-Day Moving Average

7326_C003.fm Page 55 Tuesday, March 7, 2006 6:17 AM

Page 71: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

56 What Every Engineer Should Know About Excel

The default chart shown in the window of Figure 3.25 includes shading fill applied tothe wall and floor backgrounds for the columns. These fills have been removed in thedisplays of Figure 3.26 to show the column spacing more clearly, but may be retained ormodified as needed.

3.20 Chart Format and Cosmetics

Most of the charts prepared for engineering purposes will have a rather simple formatinvolving minimal artistic or cosmetic effects. In addition, most charts and graphs will beduplicated in black and white for economy reasons, and color will not be a factor. For

FIGURE 3.24

7326_C003.fm Page 56 Tuesday, March 7, 2006 6:17 AM

Page 72: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 57

visual presentations, color is certainly used to advantage. Excel does offer the opportunityto adjust chart fills, fonts, colors, line size, and other effects. Some cosmetic effects involv-ing G & A charts have already been illustrated in Section 3.15. The combination of chartsand embedded drawing objects will be discussed in Section 4.2 and Section 4.6, and theuse of the Drawing toolbar is illustrated at that point.

The purpose of this section is to illustrate the format windows that may be called forthto make adjustments in various chart styles and appearance. Figure 3.27a shows a verysimple type 5 (Section 3.3) scatter chart with a gray fill in the plot area as obtained in thedefault setting. The main elements of the chart style that may be varied are Chart Area,

FIGURE 3.25

7326_C003.fm Page 57 Tuesday, March 7, 2006 6:17 AM

Page 73: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

58 What Every Engineer Should Know About Excel

Plot Area, Either Axis, Data Series, and Gridlines. The format process is initiated by double-clicking one of these elements and thereby calling up one of the format windows shownin Figure 3.27b through Figure 3.27f. The adjustments are then made as desired. Obviously,a very large array of choices is available. It should be noted that Fill Color for either thechart area or plot area may also be changed by using a single click followed by adjustmentin the Fill Color box on the Drawing toolbar.

3.21 Surface Charts

Surface charts of the wire mesh or color variation type may be plotted by clicking SurfaceChart on Chart Wizard. The adjustment of the chart depth (see Section 3.19) is somewhatproblematical, but may be accomplished with the following procedure:

1. Select (activate) the data.2. On Chart Wizard choose Area Chart, 3-D effect.3. Double-click Axis in Depth dimension.4. Click FORMAT/SELECTED DATA SERIES/OPTIONS. Make adjustments to the

chart depth as desired.5. Activate the chart (if not already activated).6. Click CHART/CHART TYPE.7. Select Surface Chart with either surface continuous or wire mesh options. The

3-D chart will now appear with the adjusted depth dimension.8. Repeat the procedure until the desired proportions are obtained.

Figure 3.28 shows a wire mesh surface chart for the Bessel functions of Section 3.13.

FIGURE 3.26

7326_C003.fm Page 58 Tuesday, March 7, 2006 6:17 AM

Page 74: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 59

3.22 Suggested Scatter Graph Setting as Default Chart

Because scatter graphs are often used in engineering work, the reader may find it conve-nient to choose the format and cosmetics of such a graph as the default setting for plottingdata. The following procedure may be used to establish a type 5 scatter chart as the defaultsetting with (1) black lines for all data series, (2) solid black symbols for all data markers,and (3) white fill for the plot area. Black-and-white settings are chosen because they aremost often used for duplication of reports, etc. If colors are needed, they may be addedlater. The following procedure sets up a chart that displays five data series in the foregoingformat. It will automatically adjust for fewer data series or for other types of scatter graphs.

FIGURE 3.27

7326_C003.fm Page 59 Tuesday, March 7, 2006 6:17 AM

Page 75: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

60 What Every Engineer Should Know About Excel

FIGURE 3.27 (continued)

7326_C003.fm Page 60 Tuesday, March 7, 2006 6:17 AM

Page 76: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 61

FIGURE 3.27 (continued)

7326_C003.fm Page 61 Tuesday, March 7, 2006 6:17 AM

Page 77: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

62 What Every Engineer Should Know About Excel

1. Enter the simple data set for x, y, z, t, a, and b as shown in Figure 3.29.2. Select (activate) all the data and click Chart Wizard.3. Select a type 5 scatter chart to produce the result shown in Figure 3.29. Note the

gray fill for the plot area. Colors will appear for the different data series. Do notbother with chart proportions.

4. Click each data series, followed by FORMAT/DATA SERIES/select black as thecolor for both line and markers, then click OK.

FIGURE 3.28

FIGURE 3.29

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

12345678910

A B C D E F G H I J Kx y z t a b

1 2 3 4 5 62 3 4 5 6 73 4 5 6 7 84 5 6 7 8 9

0

2

4

6

8

10

0 2 4 6x

y

z

t

a

b

7326_C003.fm Page 62 Tuesday, March 7, 2006 6:17 AM

Page 78: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 63

5. Click to activate the plot area. Then click FORMAT/FORMAT PLOT AREA/clickthe white color box, then click OK.

6. Click to activate the entire chart area. Then click CHART/CHART TYPE/CUS-TOM TYPE/Set as default chart. Name the custom setting as desired.

This default setting will allow for five sets of data series with black lines and datamarkers. If other series are added they will appear in color and must be formattedaccordingly. If types 1, 2, 3, or 4 scatter graphs are chosen for data presentation, they willalso appear with black lines and data markers. If column, bar, area, or surface charts areselected for data presentation, they will be unaffected by this default setting.

3.23 An Exercise in 3-D Visualization

This example gives the reader an opportunity to exercise his or her space visualizationcapabilities. Consider the set of 12 wire frame 3-D views of the object shown in Figure3.23. The chart in the upper-left corner is the same as that of Figure 3.28.

These objects are displayed at different rotation and elevation positions using the meth-ods described in Section 3.13. Before going further, the reader may want to examine eachof these views and try to visualize their relative positions. The 12 views are not all drawnto exactly the same scale. Some stretching has been employed to alleviate excessive com-pression of the wire frame elements.

Recall from the discussion of Section 3.13 that a rotation angle of 0° or 360° representsa view head-on or straight into the page. An elevation angle of 0° represents the sameviewing position. An elevation angle of +90° represents a view straight down on thetop of the object, whereas an elevation angle of −90° represents a view straight into thebottom of the object. With this in mind, the display of 12 views is presented in Figure3.30 along with designations of their corresponding rotation and elevation angles.

Visualizing the different object positions of Figure 3.30 without the elevation and rotationinformation is not an easy task and represents some difficulty for most readers. Thisexample does illustrate once again the display capabilities of Excel that were previouslydescribed in Section 3.18 and Section 3.21.

3.24 Editing Excel Charts Using Word

The combination of symbols and line drawings with charts is discussed in Section 4.2 andSection 4.3. At this point we indicate a procedure for editing Excel charts when symbolsand subscripts are needed. The suggested keyboard setup of Section 2.3 is very helpfulin this regard.

First, create the chart in Excel. Add all necessary text boxes, modify fonts and formatson axes, etc., as desired. Adjust chart proportions. If you are satisfied with the format,there is no need to go further. If special symbols are needed that are easier to create inWord, use the following procedure:

7326_C003.fm Page 63 Tuesday, March 7, 2006 6:17 AM

Page 79: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

64 What Every Engineer Should Know About Excel

FIG

UR

E 3.

30

-0.6

-0.4

-0.20

0.2

0.4

0.6

0.81

-0.6

-0.4

-0.2

00.2

0.4

0.6

0.8

1

E(1

4),R

(39)

E(1

9),R

(139

)

-0.6

-0.4

-0.2

00.20.4

0.60.8

1

-0.6

-0.4

-0.2

00.2

0.4

0.6

0.8

1

E(2

4),R

(329

)

E(-

40),

R(4

9)

-0.5

00.5

1

-0.6

-0.4

-0.2

00.2

0.4

0.6

0.8

1

E(-

66),

R(3

9)

E(-

40),

R(1

39)

-0.5

00.5

1

-0.5

00.51

E(-

56),

R(3

29)

E(6

0),R

(49)

S1

S2

S3

S4

S5

-0.6

-0.4

-0.2

00.2

0.4

0.6

0.8

1

S1

S2

S3

S4

S5

S1S1

E(-

26),

R(3

19)

S2

S3

S4

S5

-0.6

-0.4

-0.2

00.2

0.4

0.6

0.8

1S2

S3

S4

S5

E(-

40),

R(1

39)

-0.500.51

EE

(64)

,R(3

19)

5

-0.6

-0.4

-0.2

00.20.4

0.6

0.81

E(4

0),R

(139

)

E=

Ele

vati

on,R

=R

otat

ion

7326_C003.fm Page 64 Tuesday, March 7, 2006 6:17 AM

Page 80: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 65

1. Copy the chart to a new Word document by the following procedure:a. Activate the chart area (cells), including the text boxes. Click EDIT/COPY.b. Open a new Word document.c. Click EDIT/PASTE SPECIAL/PICTURE (ENHANCED METAFILE).

Do not click Excel Object.

2. Adjust the size of the picture with FORMAT/PICTURE/SIZE.3. Deactivate the chart (picture) and then double-click Picture. A new window will

appear with areas available for editing enclosed by dashed lines. An example ofan unedited chart is shown in Figure 3.31a. The window for editing the pictureis shown in Figure 3.31c, and the result of the editing process is shown in Figure3.31b. The edited items in this example are:a. The scale notation is changed to powers of 10, i.e., 105 instead of 100,000.b. The definition of y is added to the y-axis label and oriented vertically by

clicking FORMAT/TEXT DIRECTION/VERTICAL.c. Uppercase R is changed to lowercase r.d. The definition of x is added to the x-axis label, including the Greek symbol μ.e. A text box is added in the center of the figure, including a Greek symbol.Note that various chart elements, including gridlines, borders, text boxes, labels,

etc., may be activated by clicking and edited as desired. In addition, theelements (even individual gridlines) may be moved in position with the arrowkeys or nudged as described in Section 2.6 by pressing Ctrl in combinationwith the arrow keys. The font is edited by clicking FORMAT/FONT. Textalignment (horizontal or vertical) is edited by clicking FORMAT/TEXT DI-RECTION.

4. When the editing process is complete, click Close Picture at the upper-left cornerof the editing window. The edited chart will appear in the Word document.Position and size are adjusted as desired. The text and text box will size and movewith chart.

5. If needed, copy the chart back to the Excel workbook as a Picture (EnhancedMetafile).

3.25 Editing Excel Tables Using Word

The procedure is the same as that followed in the previous section for editing charts,except that the cell area copied to Word is the area occupied by the table. Figure 3.32illustrates the results applied to a simple table. The table is created in Excel as shown inFigure 3.32a. The cell area A1:D6 is copied to Word as a Picture (Enhanced Metafile). Thepicture is deactivated in Word and then double clicked producing the screen image shownin Figure 3.32b. The result of the editing process is shown in Figure 3.32c: Δploss/(p1 – p2)replaces dploss/(p1 − p2), β replaces b, and α replaces a. In addition, the line below Square-edged and Flow is clicked and then deleted.

As in the case of graphs, the keyboard setup of Section 2.3 is used to advantage.

7326_C003.fm Page 65 Tuesday, March 7, 2006 6:17 AM

Page 81: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

66 What Every Engineer Should Know About Excel

FIGURE 3.31

(a)

(b)

y = 0.1104x0.6594

R2

= 0.9778

10

100

1000

10000 100000x

y

y = 0.1104x 0.6594

r2 = 0.9778

10

10 2

103

104 10 5x = Reynolds Number, Re = umd/μ

y=

Nu/

Pr

0.4

Forced Convection in Tube, umd/μ > 3000

7326_C003.fm Page 66 Tuesday, March 7, 2006 6:17 AM

Page 82: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 67

3.26 Alternate Procedure

In some cases the double-click procedure mentioned before does not produce the chart ortable ready for editing as shown in Figure 3.31c. In that event, the chart may be“ungrouped” by activating the chart followed by clicking DRAW/UNGROUP on theDrawing toolbar after the figure has been copied to Word as a Picture (Enhanced Metafile).The result of such action with Figure 3.29, the subject for editing, is shown in Figure 3.33.In Figure 3.33a, we have the original figure without the gray fill. The screen dump inFigure 3.33b shows the result of ungrouping. Everything is activated as individual items.Editing is accomplished as described, by clicking the individual items. Four edits areshown in Figure 3.34. In Figure 3.34a “text” has been replaced with αβγδ in the text box.In Figure 3.34b the width of the first line segment of the bottom data series has beenincreased and the end data markers opened. In Figure 3.34c the abscissa label has beenchanged. In Figure 3.34d the border of the plot area is widened, one horizontal gridline

(c)FIGURE 3.31 (continued)

7326_C003.fm Page 67 Tuesday, March 7, 2006 6:17 AM

Page 83: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

68 What Every Engineer Should Know About Excel

FIGURE 3.32

123456

A Bdploss/(p1-p2)

Square-edged Flow Venturib orifice nozzle a = 70.4 0.86 0.8 0.10.5 0.78 0.7 0.10.6 0.67 0.55 0.1

ploss/(p1 – p2)Square-edged Flow Venturi

orifice nozzle = 70.4 0.86 0.8 0.10.5 0.78 0.7 0.10.6 0.67 0.5 .1

(a)

(b)

(c)

7326_C003.fm Page 68 Tuesday, March 7, 2006 6:17 AM

Page 84: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 69

is widened, and two of the scale markings of the abscissa are increased in size — admit-tedly an odd modification, but illustrative of the individual editing choices available.

Note again that there is no need to engage Word in the editing process unless symbolsand subscripts or superscripts are involved.

3.27 Editing Excel Charts Directly in Word by Using Grouping

If fine details of editing are not needed for an Excel chart, but only combined math–sym-bol–text additions or modifications, the chart may be copied to Word as an Excel worksheetobject. Double-clicking the chart in Word will then enable editing using all the featuresof Excel while still in Word. Additions or substitutions of math symbols for regular textcoordinate labels may be accomplished with text boxes and deletion of the original Excellabels.

FIGURE 3.33

(a)

(b)

0

2

4

6

8

10

0 2 4 6x

y

z

t

a

btext

7326_C003.fm Page 69 Tuesday, March 7, 2006 6:17 AM

Page 85: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

70 What Every Engineer Should Know About Excel

Figure 3.35 gives an example of such editing. The scatter graph of Figure 3.21 is copiedto a Word document as an Excel Chart Object using Paste Special. Double-clicking Picturein Word produces the screen shown in Figure 3.35a, with the “x” label activated. In thescreen in Figure 3.35b, a text box has been added with

αβ∫e−axdx

in 16 point type. The border and fill of the text box are then removed along with the borderfor the original chart area. The resulting text box and chart are then grouped by thefollowing procedure:

FIGURE 3.34

(a)

(b)

(c)

(d)

0

2

4

6

8

10

0 2 4 6x

y

z

t

a

btext

0

2

4

6

8

10

0 2 4 6x

y

z

t

a

b

0

2

4

6

8

10

0 2 4 6f( )d

y

z

t

a

btext

0

2

4

6

8

10

0

2 4 6x

y

z

t

a

btext

7326_C003.fm Page 70 Tuesday, March 7, 2006 6:17 AM

Page 86: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 71

FIGURE 3.35

0

2

4

6

8

10

0 1 2 3 4x

y

z

t

a

b

e-ax dx

(a)

(b)

(c)

7326_C003.fm Page 71 Tuesday, March 7, 2006 6:17 AM

Page 87: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

72 What Every Engineer Should Know About Excel

1. While holding down the Shift button, the text box and chart are both activated.2. Still holding down the Shift button, DRAW/GROUP on the Drawing toolbar is

clicked, as indicated in Figure 3.35b.

The final chart is shown in Figure 3.35c. The combination chart and text box will nowmove as one entity. To ungroup, activate the combination and click DRAW/UNGROUP.

Problems

3.1 The following data are collected in a certain experiment:

Plot the data as types 1, 2, and 5 scatter charts using linear, semilog and log–logcoordinates. Based on these plots, obtain a suitable correlation for the data. Includethe correlation equation and value of R2 on each plot.

3.2 The following additional data are collected for the experiment of Problem 3.1.Add to the original data and obtain a new correlation for the complete set of data.

x y

24,461 71.928,257 90.349,912 126.963,900 149.170,557 16279,356 16995,091 204

102,095 214107,346 199.4108,480 202.6

x y

18,000 61201,000 352

65,230 17598,750 182

7326_C003.fm Page 72 Tuesday, March 7, 2006 6:17 AM

Page 88: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 73

3.3 Plot the following data on a suitable scatter chart and obtain a trendline that bestfits the data. Include the trendline and value of R2 on the chart.

3.4 Interchange the columns in Problem 3.1, Problem 3.2, and Problem 3.3 and replotthe data with y as the abscissa. Subsequently, obtain new correlation and trendlineequations.

3.5 Two sets of variables are measured as functions of x and tabulated as follows:

Plot the data on a type 5 scatter graph using (a) the same scale for y1 and y2, (b)an expanded scale for y1, and (c) an expanded and inverted scale for y1.

3.6 Plot the data of Problem 3.5 as (a) a column chart and (b) a bar chart.

3.7 Plot the data of Problem 3.5 as a surface chart with (a) variable surface color and(b) as a wire mesh chart. Adjust chart depth as described in Section 3.21.

3.8 Using the data table command described in Section 3.17 construct a table of thefunction

y = e−0.1x × sin(nx)

for n = 1, 2, and 3 and 0 < x < π. Select the increments in x as appropriate. Plotthe function as (a) an area chart with 3-D, (b) a surface chart with variable colors,and (c) a 3-D wire mesh chart. Make adjustments in chart depth as described inSection 3.21.

x y

0.2 0.10.5 0.31.2 1.52.4 5.93.1 8.94.6 21.25.1 24.96.9 42.6

x 0 2 4 6 8 10 12

y1 0.8 0.7 0.6 0.5 0.4 0.2 0y2 1 2 3 4 5 6 7

7326_C003.fm Page 73 Tuesday, March 7, 2006 6:17 AM

Page 89: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

74 What Every Engineer Should Know About Excel

3.9 The following data are collected in an experiment:

Plot these data as types 1, 2, and 5 scatter graphs on linear coordinates. What doyou conclude? Select the most appropriate of these plots and obtain linear, expo-nential, second-order polynomial, and power correlations of the data. Display thetrendline and value of R2 for each correlation. Depending on the results of thesecorrelations, replot the data on semilog or log–log coordinates to improve the datadisplay.

3.10 Reconstruct the data of Figure 3.16 using the data table command of Section 3.17.Then plot the results as (a) an area chart with 3-D, (b) a surface chart with variablecolor, and (c) a 3-D wire mesh chart. Adjust the chart depth as described in Section3.21.

3.11 For a spectacular result, add the following fill effects to any of the charts obtainedin the previous problems:a. Fill the chart area with Fill Effects/Gradient/Colors — Preset — Rainbow/

Shading styles — Horizontal.b. Fill the plot area with Fill Effects/Colors — One color/Shading styles —

Diagonal down.

3.12 A certain common stock has the following price history:

x y

4000 275000 426000 387000 508000 459000 50

10,000 4920,000 9230,000 12040,000 115

Period Price

1 8.52 143 194 225 226 177 228 249 38

10 5011 48

7326_C003.fm Page 74 Tuesday, March 7, 2006 6:17 AM

Page 90: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Charts and Graphs 75

Plot the stock price as a function of period. Subsequently, construct moving aver-ages for the stock price having intervals of 2, 3, and 4 periods. Also, plot thestandard error for each of the moving averages. Comment on the results.

3.13 The following results are calculated from a known analytical relationship:

Choose an appropriate scatter graph for plotting y as a function of x. Then replotwith y as a function of 1/x. Select coordinate systems appropriate to the tabularvalues.

3.14 Plot the stock price data of Problem 3.12 as a column chart. Repeat for differentgap widths and overlaps.

3.15 The following data are expected to follow a quadratic relationship. Investigatethis expectation with an appropriate scatter chart and second-degree polynomialtrendline fit.

A quadratic function will plot as a straight line on linear coordinates when theratio (y – y1)/(x – x1) is plotted against x. Taking the second data set (1,3.724) forthe x1 and y1 coordinates, make such a plot and obtain a linear trendline fit to thedata. How does this result compare with that obtained using the second-degreepolynomial fit for the original data set?

x y

1 62 163 354 585 856 122

x y

0.1 3.6671 3.724

10 4.223100 7.247

1000 17.02

7326_C003.fm Page 75 Tuesday, March 7, 2006 6:17 AM

Page 91: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C003.fm Page 76 Tuesday, March 7, 2006 6:17 AM

Page 92: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

77

4

Line Drawings and Embedded Objects in Excel

4.1 Introduction

In Chapter 3 we have seen how it is possible to generate a variety of graphical displaysin Excel, which may be employed for data presentation or calculation of results. Thedrawing capabilities of Excel offer further opportunities for display of related schematicdrawings or other information along with worksheet results and data manipulations.Although the drawing capabilities in Excel are not as extensive as in certain CAD software,they are quite versatile and offer the convenience of embedding in Word texts or Excelworksheets. For those readers who use Microsoft PowerPoint, the drawing capabilitiesare even more useful.

Engineering schematics or drawings frequently involve the use of Greek or math sym-bols. The use of these symbols is a bit problematical in Excel, but we will present methodsfor generating graph coordinate labels and embedded text that are quite satisfactory.Examples and exercises in applications of the various segments of the Drawing toolbarwill be given to enable the reader to attain some facility with these elements. The readercan then expand the use as his or her need dictates.

4.2 Constructing, Moving, and Inserting Straight Line Drawings

1. Open a new worksheet. Display the Drawing toolbar.2. On the Drawing toolbar, click AutoShapes/Lines/Freeform.3. Holding down the Shift key, click the crosshair at a point to start straight lines,

quickly release-click, then move the crosshair to the next point and click again;repeat until the end of the drawing is reached, and then double-click. If the endis at a closed figure, right-click. Several line elements may be drawn separatelyto form the final drawing object, in which case multiple applications of theAutoShapes/Lines/Freeform clicking process must be performed. Line weight orstyle (including shading) may be adjusted by clicking the Line Style button onthe Drawing toolbar.The Excel worksheet grid may be used to guide the drawing process. Dependingon the size of drawing needed, it may be advantageous to work with a reducedor compressed worksheet grid by clicking VIEW/ZOOM/percent reduction.Reducing the column width with FORMAT/COLUMN/specify width may alsohelp drawing precision. The row height may also be reduced to provide a finer

7326_C004.fm Page 77 Tuesday, March 7, 2006 6:18 AM

Page 93: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

78

What Every Engineer Should Know About Excel

drawing grid. Drawing pieces may be constructed separately and then draggedtogether to assemble an overall drawing object. See “grouping” under Excel Help/Index. Precise movements of objects may be accomplished by activating the objectand holding down the Ctrl button while pressing arrow buttons for the desireddirection.

4. Callout boxes (from AutoShapes) may be used to add nomenclature, as well astext boxes, with or without arrows. Line borders of text boxes may be removedby clicking the Line Color button on the Drawing toolbar and then selecting NoLine. To avoid overlap of worksheet or graph gridlines, the text box may be filledwith white color. When math symbols or superscripts or subscripts are to be usedin text boxes or nomenclature, it will be easiest to transfer or create the drawingobject in an open Word document before adding these elements.

5. Drawing objects with all annotations may be moved, copied, or inserted elsewhereby highlighting (selecting/dragging) the cells containing the object and then click-ing EDIT/COPY. The target document is then opened, the desired locationclicked/selected (upper-left cell for the location on an Excel worksheet) and thenclick EDIT/PASTE or EDIT/PASTE SPECIAL.

6. The original drawing may be enlarged or compressed for a separate printout byusing the percentage dialog box in FILE/PAGE SETUP.

7. When the drawing is to be pasted onto another Excel worksheet, it can be drawnto fit the anticipated space allocation in the target worksheet by using the samerow/column/cell proportions during the drawing process.

8. Cosmetic features may be added.

4.2.1 Drawing Line Segments in Precise Angular Increments

To draw an unwavering straight line segment (not freeform objects) in increments of 15

°

(or precisely horizontal or vertical) click the Line icon (Figure 4.3)

on the Drawing toolbar.Then, while holding down the Shift key, click at the starting point, hold down the button,and move to the end location to draw the line. When the Shift key is not depressed, theline may be drawn in any direction. This is very useful for drawing precise horizontal orvertical lines.

Example 4.1: Assortment of Drawing Shapes

Figure 4.1 shows a collection of different drawing shapes that may be constructed usingthe Draw and Drawing toolbar functions of Excel. The following remarks refer to theobjects at the noted cell locations for items in which the construction is not obvious oralready noted on the worksheet.

K6:P10 — The donut shape is changed to a hollow cylinder using the 3-D effects tool,which allows variation in length. A gradient pattern fill is then added.

R4:R25 — A resistor shape is first drawn using the AutoShapes/Freeform lines tool(see discussion in Section 4.2, step 3) and then copied several times with anassortment of line weights (as noted). It is also compressed by dragging.

L20:M24 — A rectangle shape is drawn first. 3-D effects are added, and then a fillpattern with gradient effect is used.

7326_C004.fm Page 78 Tuesday, March 7, 2006 6:18 AM

Page 94: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

79

P15:P23 — Two circles are drawn and then filled with gradient patterns from inner-to-outer and outer-to-inner.

N24:P33 — A rectangle is drawn with 3-D and light fill applied. A resistor elementis added along with arrows and straight lines. The elements are grouped (com-bined to form one object) and then rotated.

R28:S37 — If needed, a digitized photo can be added. This is a digital photo takenwith a digital camera and transferred to the worksheet. Editing of brightness,contrast, cropping, and image size may be accomplished before transfer to theworksheet. Editing can also be performed after transfer to the worksheet byactivating the photo and then clicking VIEW/TOOLBARS/PICTURE. The Picturetoolbar will then appear.

Of course, the figure may also be presented without the presence of gridlines and columnand row headings.

Example 4.2: Construction, Assembly, and Labeling of a Line Drawing

An illustration of the mechanisms of an assembly of line drawings in Excel along withnomenclature in Word is shown in Figure 4.2:

1. In Figure 4.2a, a shell of a solar absorber is drawn with AutoShapes/Lines/Freeform as described previously.

FIGURE 4.1

7326_C004.fm Page 79 Tuesday, March 7, 2006 6:18 AM

Page 95: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

80

What Every Engineer Should Know About Excel

2. Next, the inner boundary is drawn in Figure 4.2b and added to Figure 4.2a toproduce the combination shown in Figure 4.2c. In practice, the two elementswould not be moved around as shown here. The drawings are copied to showthe steps as they progress.

3. A 5% pattern fill is added to the inner boundary as shown in Figure 4.2d. Thisrepresents the air inside the collector.

4. A long thin rectangle is drawn in Figure 4.2e and filled with a 25% pattern fill.The dimensions of the rectangle are squeezed, adjusted, and moved to the top ofthe shell as shown in Figure 4.2f. This element represents the glass cover of thesolar collector.

5. A 4

1

/

2

pt black line is added in Figure 4.2g to indicate the black absorbing surfaceof the bottom of the solar collector.

FIGURE 4.2

Solar Absorber (Collector)

(q/A) solar Glasscover

Blackabsorber

(q/A) Load

h, T

T3 = Radiation temperature

T1

xkeff

T2

5% patternfill25% patternfill

7326_C004.fm Page 80 Tuesday, March 7, 2006 6:18 AM

Page 96: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

81

6. The elements of the assembled drawing are then grouped by (1) holding downShift, (2) clicking on the elements in sequence, and (3) clicking Draw/Group. Theassembled object may now be moved or copied as a single object. In Figure 4.2i,it has been rotated by either clicking Draw/Rotate or clicking the Rotate icon anddragging to the desired angle.

7. The assembled drawing is then copied to a Word page in which nomenclature isadded with subscripts and appropriate symbols. It may either be used in the Worddocument or copied to an Excel worksheet as was done here. The final diagramis shown in Figure 4.2h. The printout shown here is without gridlines or columnand row headings. The gridlines are useful when constructing the drawing ele-ments.

Example 4.3: Practice Exercises with the Drawing Toolbar

A familiarization with the Drawing toolbar shown in Figure 4.3 may be accomplished bycarrying out the following exercises, which refer to the drawing objects shown in Figure4.1 and Figure 4.2. The solar absorber in Figure 4.2 is considered first:

For Figure 4.2a, click AutoShapes (fourth icon from the left on Drawing Toolbar),then Lines, and then Freeform (bottom row, center of six icons). Hold down theShift key, move the crosshair to the desired starting point (a corner of a cell), clickquickly, and release the mouse button. Move the crosshair to the next corner, clickquickly, and continue until five segments (two top lips, two sides, and a bottomsegment) are in place. Double-click at the last point.

For Figure 4.2b, perform the same operation as that of Figure 4.2a, except that onlythree line segments are required. Line up the drawing using a worksheet grid toobtain the dimensions in Figure 4.2b.

For Figure 4.2c, activate the drawing in Figure 4.2b and drag-move to match withFigure 4.2a as shown in Figure 4.2c. Once the drawings are assembled, activateFigure 4.2b — click until boundary handles appear. Then click the Fill icon (eighthfrom the right on the Drawing toolbar). Select Fill Effects and then the Patterntab. The 5% fill is the block in the upper-left corner. Click this corner, and thenOK. Fill will appear as in Figure 4.2d.

FIGURE 4.3

7326_C004.fm Page 81 Tuesday, March 7, 2006 6:18 AM

Page 97: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

82

What Every Engineer Should Know About Excel

For Figure 4.2e, click on the rectangle icon (seventh from the left on the Drawingtoolbar) and move-drag the crosshair while holding down the mouse button tocreate a rectangle. Release the mouse button when the desired shape is attained.Do not worry if the rectangle is not the exact size or proportion needed. That willbe taken care of later. Next click on the Fill icon, Fill Effects, and then select Patternsand the fourth box in the left column for 25% fill. Click OK, and the rectangle willappear as in Figure 4.2e.

Drag the filled rectangle to a position on top of the drawing in Figure 4.2d. Thendrag, squeeze, or stretch to the slim dimensions shown by positioning the double-arrow pointer on the side handles of the filled rectangle by holding down themouse button and dragging until the two figures line up. Nudge it into exactposition using the Ctrl button in conjunction with the arrow keys.

Next, draw a straight line at the inside bottom of the collector using AutoShapes/Lines/Freeform as in Figure 4.2a and Figure 4.2b. Click the Line Style icon (fifthfrom the right on the Drawing toolbar) and select the 4

1

/

2

pt line.Group the drawing elements created earlier by holding down the Shift key and

clicking in sequence the four elements (a, b, e, and 4

1

/

2

pt line). Then click Draw(the left icon on the Drawing toolbar) and select Group at the top of the palette.The composite object may now be moved as a single entity.

At this point the composite figure may be copied to an open Word document byactivating the object and then clicking EDIT/COPY. Open a Word document sheetand click EDIT/PASTE to paste the composite figure.

The nomenclature elements are added by using either text boxes or callout arrows(as for T

1

and T

2

) that are called from the Drawing toolbar in Word using Au-toShapes/Block Arrows/select a callout arrow icon. Note that subscripts or mathsymbols are typed in conventional Word fashion (see Section 2.3).

After the nomenclature is added, the composite drawing is copied back to the Excelworksheet, where it appears as shown in Figure 4.2h.

Rotation of the object may be performed by activating the object and either clickingDraw/Rotate or Flip, or by clicking the Rotate icon (third from the left on theDrawing toolbar).

The following exercises refer to some of the drawing objects shown in Figure 4.1:

1. Create circles as shown in the figure at P16. Click on the Ellipse icon (eighth fromthe left on the Drawing toolbar). Holding down the Shift key, create a circle bymoving the crosshair until the desired size is accomplished. While the circle isstill activated (handles appearing), click the Fill icon and then Fill Effects. ClickShading Styles/From Center/ then select the right-hand Variant (dark center).Click OK. The circle at P21 is formed using the left Variant (dark edge). The degreeof shading may be adjusted with the Dark to Light slider.

2. Create donut shapes at K2:M10. Use AutoShapes/Basic Shapes/Donut. Drag theyellow dot to achieve the desired size.

3. Create the hollow cylinder, as shown, at N9 by first creating a donut. Then clickthe 3-D icon (first icon on the right of the Drawing toolbar) and choose the lower-left icon (or others if you prefer.) Click 3-D settings, then the sixth icon from theleft, and then the desired length to change the length of the cylinder. To accomplish

7326_C004.fm Page 82 Tuesday, March 7, 2006 6:18 AM

Page 98: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

83

the shading, activate the object, click Fill icon/Fill Effects/Gradient/ShadingStyles/Horizontal/Variants as desired, and then click OK.

4. Create arcs at A19 using AutoShapes/Basic Shapes/Arc. Then repeat while hold-ing down the Shift key. Note that circular arcs are created. Note the effect ofdragging the yellow dot.

5. The resistor elements at R5:S25 are created by (1) using AutoShapes/Lines/Free-form to construct a single resistor, (2) copying the resistor to rows 7, 10, 12, and15, (3) changing the line width of each copied resistor, (4) copying and compressing(by dragging handles) the resistor to R17, and (5) subsequently copying the com-pressed resistor to R19, R21, R23, and R25. The line weights of these last resistorsare also modified as indicated.

If all of these exercises are performed, a person should attain a reasonable facility withuse of the Drawing toolbar. Of course, further experimentation is encouraged.

4.3 Inserting Items in Excel with Symbols, Subscripts, and Superscripts

It is possible to use symbols (Greek, math, or any other) in an Excel worksheet by callingup the symbol font. When used as a column heading or as a variable name, the characterswill not transfer as symbols to the coordinates of a graph. The same restriction appliesfor superscripts and subscripts in mathematical formulas or other terms that might beused on a graph.

Equations and text with symbols may be typed in Word and copied to Excel worksheetsor graphs as Word documents, but the result is a block one page wide that obscuresinformation on the worksheet below the block. Such a copying procedure is quiteacceptable for inserting documentation remarks pertaining to a spreadsheet program,but is not satisfactory for titles of figures or axis labels. A text box created in Word mayalso be copied to Excel as a Word document, but any symbols contained therein will belost.

The solution to the problem is to create the item, equation, or text in Word usingwhatever format is desired and then to copy it to Excel as a Picture (Enhanced Metafile)object. A possible procedure is as follows:

1. Create the item, equation, title, or object in Word, using symbols, superscript, andsubscript notations as needed. Single or multiple columns may be used in theformat, depending on the style and appearance desired. Several objects may becreated at one time on a single sheet for subsequent transfer to an Excel worksheetor graph. In Word, it is possible to create a text box that allows rotation of text orsymbols inside the box into a vertical position. This may be the desired formatfor the label of a vertical axis on a graph. The procedure is as follows:a. Open the Drawing toolbar in Word by clicking VIEW/TOOLBARS/DRAW-

ING.b. Click on Text Box.c. Anticipate the size of the text box needed and click and drag to set the size.d. Enter text or symbols in the box. Open the Text Box toolbar with VIEW/

TOOLBARS/TEXT BOX.

7326_C004.fm Page 83 Tuesday, March 7, 2006 6:18 AM

Page 99: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

84

What Every Engineer Should Know About Excel

e. In the Text Box toolbar dialog box (far right) click to rotate the text into thedesired position. An alternate procedure is to activate the text box and thenclick FORMAT/TEXT DIRECTION/select desired alignment of text.

f. Adjust the final size of the text box to the desired proportions. To remove theline border around the text box, click the Line Color icon in the Drawing toolbarand then select No Line.

Save the Word document with an appropriate name and close.2. Create the Excel worksheet or graph, leaving blank the column title, axis title, or

whatever nomenclature you may wish to fill with a copied item from Word. Savethe workbook with an appropriate title.

3. Return to the saved Word document. Select the item in Word to be copied to Excelby clicking and/or dragging.

4. Click EDIT/COPY.5. Reopen the Excel workbook.6. If the item is to be inserted on a worksheet, click the cell where it is to be inserted.

If it is to be inserted on an embedded graph in a worksheet, click on an open cellnearby.

7. Click EDIT/PASTE SPECIAL/Picture (Enhanced Metafile). Do not chooseMicrosoft Word Document Object. The item will appear at the clicked location onthe worksheet.

FIGURE 4.4

7326_C004.fm Page 84 Tuesday, March 7, 2006 6:18 AM

Page 100: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

85

8. Click or drag the item to the exact location desired on the graph or worksheet.Check the final style and location with FILE/PRINT PREVIEW. Modify as needed.

9. If the item is to be inserted on a separate graph sheet, activate the graph, andfollow the same PASTE SPECIAL procedure as mentioned earlier. In this case, theitem will appear at the upper-left corner of the graph. Click or drag the item tothe final position desired.

10. Repeat the procedure for as many items as required.

If there are no symbols required in the Excel sheets, there is no need to involve Wordat all. The editing applications can all be accomplished on the Excel sheet. In Word it ispossible to set up the keyboard using shortcut keys for symbols so that the time-consumingINSERT/SYMBOL process for each symbol is avoided (see Section 2.3). For some graphicsand drawing objects, a preferable procedure may be to (1) create the graphic or object inExcel, (2) COPY/PASTE to Word as an Excel worksheet, (3) perform editing involvingsymbols, subscripts, etc. in Word, and then (4) COPY/PASTE SPECIAL back to Excel (orto a Word document) as Picture (Enhanced Metafile). If transferred to an Excel worksheet,the graphic or object may then be moved, compressed, or expanded as needed.

4.4 Inserting Equations or Symbols in Word Using Equation Editor

This is achieved by the following procedure:

1. Designate the location for an insert. See Figure 4.4.2. Click INSERT/OBJECT/remove the check from Float Over Text, then click

Microsoft Equation 3.0 followed by OK. This action will result in a fixed locationof the symbol or equation, i.e., one that may not be dragged to other positions.

3. Proceed with use of Equation Editor for constructing either complete equationsor symbols.

4. Click FILE, move the cursor away from File Menu, and click again. The equationor symbol will be fixed in the designated position.

5. If the object is to be used for nomenclature on a table or chart, dragging or nudgingto the exact position may be needed. In this case, the Float Over Text check markshould be left intact in step 2. It will not be possible to produce a lineup with textas shown in the following example when the “float” position is in effect.

The example shows the insert of a summation sign with limits of i = 2 and i = n

1 intoan equation at the point indicated by the arrow. The summation symbol is called byclicking on the point indicated in the Equation Editor window.

Area = [y

1

+ y

n

+ y

i

/2]

Δ

x

Area = [y

1

+ y

n

+ y

i

/2]

Δ

xi

i n

=

= −

∑2

1

7326_C004.fm Page 85 Tuesday, March 7, 2006 6:18 AM

Page 101: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

86

What Every Engineer Should Know About Excel

4.5 Inserting Equations and Symbols in Excel Using Equation Editor

This is achieved as follows:

1. Select cell for location of Equation.2.

Click INSERT/OBJECT/Microsoft Equation 3.0/OK.3. Before starting construction of an equation or symbol, set the size of the type by

clicking SIZE/OTHER/enter desired final point size. Click OK.4. Construct equation or symbols using features of Equation Editor.5. When an equation or symbol has been constructed, double-click the object until

it is highlighted or activated.6. Click EDIT/CUT.7. Click the cell or chart location for the insert.8. Click EDIT/PASTE. The object will appear at the designated cell or at the upper-

left corner of the chart.9. Activate the object and drag to the final desired location. A box may enclose the

object. Remove the line enclosing the box, if desired, by activating the object andclicking Line Color/No Line on the Drawing toolbar.

10. An empty box will appear at the cell chosen in step 1. Delete it.11. To edit the object equation or symbol, double-click to activate it, and the Equation

Editor toolbar will reappear. Edit as usual.

Example 4.4: Graphics, Symbols, and Text Combinations

An example of the use of inserts and graphics composed and copied between Word andExcel is shown in Figure 4.5. In this figure, the assembly of items is printed as a worksheetwith column and row headings. Of course, the gridlines and row and column headingscould have been left out to give a more appealing appearance for a final presentation.Some elements of the assembly are shown at the following cell locations:

A1:F12 — This is the Excel calculation of the equation at G11. The equation at G11was written in Word and copied to the worksheet at this location.

I2:M9 — This is the cavity drawing assembly. The cavity and semitransparent coverwere drawn as separate objects in Excel, grouped, and copied to Word. The labelsusing subscripts and Greek symbols were then added in Word, and the totalassembly copied back to the final Excel worksheet.

B14:L41 — The graph was plotted from the Excel calculations using Chart Wizardwith a type 3 x-y scatter graph chosen for the presentation (see Section 3.3). Thex- and y-axis labels were composed in Word and copied to the Excel worksheet,as was the equation for K shown at G18. The labels for K = 5, 2, etc., were insertedas text boxes on the Excel worksheet. Composition in Word was not neededbecause no Greek symbols are involved.

B44:I61 — This descriptive write-up was composed in Word and then copied to anExcel worksheet.

All of the necessary compositions in Word were accomplished on a single page, so thesubsequent copying process was relatively easy. The final worksheet is shown in Figure4.5 after use of FILE/PAGE SETUP/PAGE/Scaling/Fit to 1 page wide by 1 page tall.

7326_C004.fm Page 86 Tuesday, March 7, 2006 6:18 AM

Page 102: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

87

FIGURE 4.5

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960

A B C D E F G H I Jemarea emapp(0.1) emapp(0.5) emapp(1.0) emapp(2.0) emapp(5.0)

0 1 1 1 1 10.1 0.5 0.833333 0.909091 0.952381 0.9803920.2 0.333333 0.714286 0.833333 0.909091 0.9615380.3 0.25 0.625 0.769231 0.869565 0.9433960.4 0.2 0.555556 0.714286 0.833333 0.9259260.5 0.166667 0.5 0.666667 0.8 0.9090910.6 0.142857 0.454545 0.625 0.769231 0.8928570.7 0.125 0.416667 0.588235 0.740741 0.8771930.8 0.111111 0.384615 0.555556 0.714286 0.8620690.9 0.1 0.357143 0.526316 0.689655 0.847458

1 0.090909 0.333333 0.5 0.666667 0.833333

Apparent Emissivity of Cavity with Partially Transparent Cover

A1 = inside area of cavityA2 = area of opening

1 = emissivity of inside cavity surface

2 = emissivity of transparent cover

2 = transmissivity of transparent cover

2 + 2 + 2 = 1.0Behavior Limits

2 1.0, ( 2 = 0); behaves as open cavity (Prob. 8-129)

2 1.0 and A 2/A1 1.0; app 1

2 0 (opaque); cavity with opaque shield

2 0 and A 2/A1 = 1.0; shield on flat surface

2 0 and 1 = 1.0; opaque shield on black surface, app = 2 /2

app /( 2 + 2/2)= K/[(A 2/A1)(1 - 1)+ K]

(A2/A1)(1 - 1)

K = 1/( 2 + 2/2 )

A 1 , 1

A 2 = area of opening

semitransparent cover

2+

2+

2= 1.0

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

K=5

K=2

K=1

K=0.5

K=0.1

K=0.9

K=0.7

K=0.3

K=0.2

K=0.1

app/(

2+

2/2

)

7326_C004.fm Page 87 Tuesday, March 7, 2006 6:18 AM

Page 103: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

88

What Every Engineer Should Know About Excel

A network schematic is used to derive the equations is shown in Figure 4.6.

Example 4.5: Program with Embedded Text Documentation

Figure 4.7 illustrates a convenient combination of Word and Excel. A program is pre-sented at A2:D3 with variables and nomenclature at E2:F15. The documentation anddescription of the program was written as a Word document using Greek symbols,subscripts, and superscripts and then copied to the Excel worksheet. This combinationresults in a very compact presentation on a single page (if one can tolerate the smalltype size). A reader studying the program will find it much easier to follow than adocumentation occupying several pages.

4.6 Construction of Line Drawings from Plotted Coordinates

A closed figure may be constructed in Excel by plotting a sequence of data points thatreturns to the initial coordinate set. An initial sketch on ordinary graph paper may formthe basis for generating a smoothed line drawing when combined with the editingfeatures of Excel graphs. We illustrate this technique with an airfoil shape. The airfoilshape has been hand-sketched on a sheet of graph paper graduated in increments of 0.1inches. The x- and y-coordinates of the shape are then tabulated in sequence startingwith the trailing edge of the airfoil, proceeding along the bottom surface of the section,

FIGURE 4.6

Eb1

Eb2

J2i/(1 - 2) J2o/(1 - 2)

Eb3

(1- 1)/ 1A1

1/A1F13 2

1/A2F23(1- 2)1/A1F12(1- 2)

2/ 2A2(1- 2)2/ 2A2(1- 2)

For T 3 =0, E b3 = 0, and

q1 = (Eb1 – 0)/ R = appA2(Eb1 – 0)

app =1/(A 2 R) = ( 2 + 2/2)K/[(A 2/A1)(1 - 1) + K]

7326_C004.fm Page 88 Tuesday, March 7, 2006 6:18 AM

Page 104: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

89

and then around the top surface back to the trailing edge. The resulting data are shownin columns A and B of Figure 4.8, with the dimensions given in inches. A type 3 scatterchart is plotted and also appears in Figure 4.8, without editing of the chart proportions.Note that the fitted computer curve for the tabulated data is not as smooth as one wouldexpect for an airfoil section. This unevenness results from either a poor sketch (by theauthor) to begin with or inaccurate readings of the coordinates of the sketch.

The unevenness may be smoothed by first adjusting the chart proportions to thedistorted form shown in Figure 4.9, which emphasizes the imperfections in the plot.Next, the data series is activated and data points double-clicked at points along thecurve that appear to need adjustment. These points are then gently dragged to newpositions to smooth out the curve. Two overcorrections are shown in Figure 4.10 toillustrate the action. The results of gentle smoothing are shown in Figure 4.11. Note thatthe results of the smoothing (or overcorrecting) also appear in the tabulated values forx and y.

Once the surface curve has been smoothed, the chart proportions are adjusted by drag-ging the side handles until the increments in x- and y-coordinates have the same chartmeasurements. The results are shown in Figure 4.12.

FIGURE 4.7

7326_C004.fm Page 89 Tuesday, March 7, 2006 6:18 AM

Page 105: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

90

What Every Engineer Should Know About Excel

FIGURE 4.9

FIGURE 4.10

x y8.5 0.97.7 0.86.6 0.75.6 0.654.4 0.53.6 0.52.8 0.45

2 0.551.1 0.8

0.85 1.251.2 1.7

2 1.92.55 2

3.4 1.94.8 1.7

6 1.47 1.2

7.8 18.5 0.9

0

0.5

1

1.5

2

2.5

0 2 4 6 8 10

x

x y8.5 0.97.7 0.86.6 0.75.6 0.654.4 0.53.6 0.52.8 0.645

2 0.551.1 0.8

0.85 1.251.2 1.7

2 1.92.55 1.84

3.4 1.94.8 1.7

6 1.47 1.2

7.8 18.5 0.9

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

0 2 4 6 8 10

x

7326_C004.fm Page 90 Tuesday, March 7, 2006 6:18 AM

Page 106: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Line Drawings and Embedded Objects in Excel

91

FIGURE 4.11

FIGURE 4.12

x y8.5 0.97.7 0.86.6 0.75.6 0.594.4 0.53.6 0.52.8 0.5

2 0.551.1 0.8

0.85 1.251.2 1.71.8 1.9

2.55 1.9763.4 1.9

4.68 1.76.18 1.417.08 1.27.94 1.01

8.5 0.9

0

0.5

1

1.5

2

2.5

0 2 4 6 8 10

x

x y8.5 0.97.7 0.86.6 0.75.6 0.594.4 0.53.6 0.52.8 0.5

2 0.551.1 0.8

0.85 1.251.2 1.71.8 1.9

2.55 1.9763.4 1.9

4.68 1.76.18 1.417.08 1.27.94 1.01

8.5 0.9

0

0.5

1

1.5

2

2.5

0 1 2 3 4 5 6 7 8 9 10

0

0.5

1

1.5

2

2.5

0 1 2 3 4 5 6 7 8 9 10

7326_C004.fm Page 91 Tuesday, March 7, 2006 6:18 AM

Page 107: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

92

What Every Engineer Should Know About Excel

Problems

4.1 Plot the function y = 3.25 xe

0.1x

over the range 0 < x < 5 using a type 3 scatterchart (Section 3.3) without a y-axis label. Copy the chart to a Word document andinsert a vertical text box containing the aforementioned function for the label ofthe ordinate. Type and insert a horizontal text box containing the equation ontothe chart at an appropriate position. Choose font sizes to match the size of thechart. Copy the resulting chart back to Excel using PASTE SPECIAL/PICTURE(Enhanced Metafile). Adjust the size of the resulting graph using the Formatcommand and print out the results.

4.2 Construct the asymmetric circles shown. Then fill the areas as indicated (or witha fill pattern of your choice), and engage the 3-D effects shown.

4.3 Create the text box shown with an inserted equation. Then modify with the filland shadow effects indicated. Note that activating the text box followed by FOR-MAT/TEXT DIRECTION creates the vertical text box.

4.4 Create Figure 4.6

by first creating the resistor elements as described in Section 4.3.Then create the small circles. The resistor elements may be rotated by clickingDraw/Rotate or Flip on the Drawing toolbar. Assemble the drawing in Excel andgroup with Draw/Group. Copy the assembled drawing to a Word document andinsert all the labels using text boxes without line borders. Copy the resultinglabeled drawing back to Excel as a Picture (Enhanced Metafile) and print out inseveral different sizes. Also, construct the equations below the diagram in Wordand copy them to Excel using the same Picture format.

4.5 If you have not already done so, work through the exercises in Section 4.3

7326_C004.fm Page 92 Tuesday, March 7, 2006 6:18 AM

Page 108: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

93

5

Solution of Equations

5.1 Introduction

In this chapter, we will examine the features of Excel that provide for solutions ofsingle or simultaneous linear and nonlinear equations. Four methods will be described:(1) iterative techniques, (2) use of the Goal Seek feature, (3) use of the Solver feature,and (4) matrix inversion with the associated matrix operations. Examples will be givenfor each method and comments offered on the selection of the best method for aparticular problem. Finally, a brief discussion will be presented on the creation ofmacros, along with an example.

5.2 Solutions to Single Nonlinear Equations Using Goal Seek

Nonlinear equations may be solved for real roots quite easily by using the Goal Seekfeature, which is called by clicking TOOLS/GOAL SEEK. First, the equation is written inthe form

ƒ

(x) = 0

Keeping in mind that nonlinear equations may have multiple roots, including complexones, it may be advantageous to plot the function to get an idea of the location of thepossible roots. Goal Seek uses an iterative scheme to solve the equation, and an initialguess must be provided to start the computation. A graphical display may be useful inchoosing the initial guess.

We consider two examples — a transcendental equation

ƒ

(x) = x tanx

2 = 0 (5.1)

and a cubic polynomial

ƒ

(x) = 3x

3

2x

2

+ x

18 = 0 (5.2)

The transcendental equation is plotted in Figure 5.1a using increments in x of 0.05 overthe range

2 < x < +2. A visual survey of the graph indicates that there is a root at x

1.0.The worksheet in Figure 5.1b is set up with an initial guess for x inserted in cell B4 and

the formula for

ƒ

(x) in cell B6. The guess of x = 1.0 was chosen by consulting the plot in

7326_C005.fm Page 93 Tuesday, March 7, 2006 6:19 AM

Page 109: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

94

What Every Engineer Should Know About Excel

Figure 5.1a. Next, TOOLS/GOAL SEEK is clicked, which produces the window in Figure5.1d. We set cell B6 = 0 by changing (iterating) the values of x in cell B4. When OK isclicked, the window in Figure 5.1e appears along with the solution on the worksheetshown in Figure 5.1c. Because of symmetry, there is also a root at x =

1.076845.

FIGURE 5.1

-80

-60

-40

-20

0

20

40

60

80

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

(a)

(b)

(c)

34567

A B

x= 1

f(x)= =B4*TAN(B4)-2

34567

A B

x= 1.076845

f(x)= -0.00019

7326_C005.fm Page 94 Tuesday, March 7, 2006 6:19 AM

Page 110: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations

95

The same procedure is followed with the cubic polynomial. A graph of the function isshown in Figure 5.2a, indicating a root at about x

2 (it turns out that the root is exactly2.0). The worksheet is set up as shown in Figure 5.2b with an initial guess taken as x = 0.(We could have chosen x = 2.0, but that would not be as interesting.) Again, TOOLS/GOAL SEEK is called, and the solution is shown in Figure 5.2c having a value of x =1.99999856

2.0.The graph for the cubic indicates that we should not expect any other real roots. Dividing

the cubic by (x

2) to extract the real root yields a quadratic function:

(3x

3

2x

2

+ x

18)/(x

2) = 3x

2

+ 4x +9

The roots of this quadratic are complex and have the values x = 2/3

±

1.5986i.

5.3 Solutions to Single Nonlinear Equations Using Solver

Solver and Goal Seek offer alternate ways to solve nonlinear equations, although bothemploy iterative methods. A graph of the function is helpful in both instances, because itindicates a reasonable value to use as the initial guess in the iterative process.

For Solver examples, we use the same nonlinear equations as used in the Goal Seekexamples. In the top portion of Figure 5.3 we have the worksheet set up for the transcen-dental equation

ƒ

(x) = x tanx

2 = 0

FIGURE 5.1

(continued)

7326_C005.fm Page 95 Tuesday, March 7, 2006 6:19 AM

Page 111: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

96

What Every Engineer Should Know About Excel

TOOLS/SOLVER is clicked, and the Solver Parameters window is displayed, target-ing cell B4 to approach zero by changing the value of cell B3. An initial guess is listedas x = 1.0, and the solution is given in the right side of the top portion of Figure 5.3as x = 1.0769 with a residual value of

ƒ

(x) = 4.3E

7.The bottom portion of Figure 5.3 gives the worksheet for the cubic equation

ƒ

(x) = 3x

3

2x

2

+ x

18 = 0

This time the target function is cell E4, which is to approach zero by changing thex-values in cell E3. An initial guess of x = 1 is taken, and the result is given as x =2.00000001 with a residual value of

ƒ

(x) = 2.9E

7.

FIGURE 5.2

(a)

x f(x)-5 -448-4 -246 1-3 -120-2 -52-1 -240 -181 -162 03 484 1465 312

-500

-400

-300

-200

-100

0

100

200

300

400

-5 -4 -3 -2 -1 0 1 2 3 4 5

x

f(x)

(b)

456

A Bx= 0

f(x)= =3*B4^3-2*B4^2+B4-18

(c)

456

A Bx= 1.99999856

f(x)= -4.181E-05

7326_C005.fm Page 96 Tuesday, March 7, 2006 6:19 AM

Page 112: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations

97

FIGURE 5.3

2345

A B

x= 1f(x)= =B3*TAN(B3)-2

2345

A B C

x= 1.076874f(x)= 4.29E-07

2345

D E

x= 1f(x)= =3*E3^3-2*E3^2+E3-18

2345

D E

x= 2.00000001f(x)= 2.9261E-07

7326_C005.fm Page 97 Tuesday, March 7, 2006 6:19 AM

Page 113: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

98

What Every Engineer Should Know About Excel

5.4 Iterative Solutions to Simultaneous Linear Equations

The following procedure may be used as an alternative to Gauss–Seidel or matrix solutionsof simultaneous linear equations. It is particularly applicable to steady-state nodal equa-tions in problems in which sparse coefficient matrices are involved.

1. Open a new Excel worksheet.2. Click on TOOLS/OPTIONS/CALCULATION TAB/check Iteration box.3. Next, select VIEW TAB (while still under TOOLS/OPTIONS) and check Formulas

under Window options. Then click OK to return to worksheet.4. Enter equations in the worksheet using the following format:

A

i

=

ƒ

(A

j

’s)

For example, the equations

A

1

+ 2A

2

= 3

2A

1

+ 5A

2

=7

would appear as shown in Figure 5.4.5. Equations will now be in view on the worksheet.

Check carefully to be sure thereare no mistakes. Do not go further unless the equations are correct

. If desired, theworksheet may be printed at this point to obtain a hard copy of equations.

6. Click TOOLS/OPTIONS/VIEW, and under the Windows option, remove thecheck on Formulas and click OK.

Solutions will now appear on the worksheet, inaccordance with the number of iterations selected. The default value is 100 itera-tions with a deviation of 0.001. These values may be changed to obtain greateraccuracy. The solutions may be printed as needed.

Example 5.1: Solution of Nine Nodal Equations

The following set of equations is obtained from a nodal analysis of a combined convec-tion–conduction heat-transfer problem. Nine nodes were involved, so nine equations mustbe solved to obtain the temperature distribution in the solid. We have already written theequations in the format for an iterative solution.

T

1

= (15.625 + 1.15T

2

+ 1.15T

4

)/5.425

FIGURE 5.4

123

=3-2*A2=(7-2*A1)/5

7326_C005.fm Page 98 Tuesday, March 7, 2006 6:19 AM

Page 114: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations

99

T

2

= (1.15T

1

+ 1.15T

3

+ 31.25 + 2.3T

5

)/10.85T

3

= (1.15T

2

+115 + 31.25 +2.3T

6

)/10.85T

4

= (1.15T

1

+ 2.3T

5

+ 1.15T

7

)/4.6T

5

= (T

2

+ T

4

+ T

6

+ T

8

)/4T

6

= (T

3

+ T

5

+ T

9

+ 100)/4T

7

= (1.15T

4

+ 115 +2.3T

8

)/4.6T

8

= (T

5

+ T

7

+ T

9

+ 100)/4T

9

= (T

6

+ T

8

+ 200)/4

The set of equations for a nine-node analysis of the problem is shown as columns Aand B of the accompanying worksheet (Figure 5.5). A matrix of the nine equations wouldbe rather sparse because each T does not connect with all of the other Ts. The equationsare displayed as a group by clicking TOOLS/OPTIONS/VIEW/Formulas. The iterativesolution is obtained by clicking TOOLS/OPTIONS/CALCULATION/check Iteration. TheFormulas check mark is then removed, and the numerical solution is displayed as shownin Figure 5.5. The windows for the iterations and “view formulas” are shown in Figure 5.6.

5.5 Solutions of Simultaneous Linear Equations Using Matrix Inversion

We noted in solving the set of nine equations in Example 5.1 that a matrix solution to theproblem would require entry of many more constants than the iterative solution, becausethat particular problem involved a very sparse matrix. For nonsparse matrices (or if oneprefers, for sparse ones too), matrix inversion may be an attractive solution method. Excelprovides a very easy procedure for obtaining such solutions.

The set of linear equations may be written in the form

[A][X] = [C] (5.3)

where [A] is the coefficient matrix, [X] is the set of unknown variables, and [C] is theconstant matrix. The set of two equations

x

1

+ 2x

2

= 5

FIGURE 5.5

123456789

A BT1= =(15.625+1.15*B2+1.15*B4)/5.425T2= =(1.15*B1+1.15*B3+31.25+2.3*B5)/10.85T3= =(1.15*B2+115+31.25+2.3*B6)/10.85T4= =(1.15*B1+2.3*B5+1.15*B7)/4.6T5= =(B2+B4+B6+B8)/4T6= =(B3+B5+B9+100)/4T7= =(1.15*B4+115+2.3*B8)/4.6T8= =(B5+B7+B9+100)/4T9= =(B6+B8+200)/4

123456789

T1= 17.86873671T2= 19.51926393T3= 29.93322808T4= 51.18759724T5= 54.59206411T6= 67.86016025T7= 77.69751626T8= 79.80123229T9= 86.91534814

7326_C005.fm Page 99 Tuesday, March 7, 2006 6:19 AM

Page 115: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

100

What Every Engineer Should Know About Excel

3x

1

5x

2

=

7

will have

[A] =

FIGURE 5.6

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

A BT1= =(15.625+1.15*B2+1.15*B4)/5.425T2= =(1.15*B1+1.15*B3+31.25+2.3*B5)/10.85T3= =(1.15*B2+115+31.25+2.3*B6)/10.85T4= =(1.15*B1+2.3*B5+1.15*B7)/4.6T5= =(B2+B4+B6+B8)/4T6= =(B3+B5+B9+100)/4T7= =(1.15*B4+115+2.3*B8)/4.6T8= =(B5+B7+B9+100)/4T9= =(B6+B8+200)/4

1 23 5−

7326_C005.fm Page 100 Tuesday, March 7, 2006 6:19 AM

Page 116: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations

101

[C] =

as the respective coefficient and constant matrices.The solution is expressed as

[X] = [A]

1

[C] (5.4)

where [A]

1

is the inverse of the coefficient matrix, and [A]

1

[C] is the product of the twoindicated matrices.

Excel provides two worksheet functions to perform the matrix inversion and productoperations. The function

MINVERSE(square array)returns the inverse of the square array designated in the parentheses. Note that a squarearray is required for this function. The function

MMULT(matrix 1, matrix 2)returns the product of the two matrices in the parentheses. These need not be squarearrays. Once the arguments are entered, pressing Ctrl+Shift+Enter activates either matrixworksheet function. If only a single value is returned instead of a matrix, you have failedto execute the Ctrl+Shift+Enter input. The procedure for obtaining matrix solutions tosimultaneous linear equations is, therefore, as follows:

1. Enter the coefficient matrix in a worksheet as a square array.2. Determine the inverse of this array using the MINVERSE worksheet function.3. Enter the constant matrix in worksheet.4. Multiply the results of step 2 by the array in step 3 to obtain the solution.

Example 5.2: Nine Nodal Equations

The method may be illustrated by solving the nine-equation example in Example 5.1. Theworksheet is shown in Figure 5.7 in three segments. First, the 9

×

9 array for the coefficientmatrix is entered as [A] in the 81 cells A4:I12, whereas the constant matrix [C] is enteredin the 9 cells of U4:U12. The inverse [A]

1

is obtained by the following:

1. Activating cells K4:S12 to reserve space for [A]

1

.2. Entering the formula =MINVERSE(A4:I12) in cell K4 at the top-left corner of the

array.3. Pressing Ctrl+Shift+Enter to execute the inverse function.

The coefficients of [A]

1

will appear in cells K4:S12 as shown. Next, nine cells areactivated at W4:W12 to reserve space for the solution matrix [T]. The formula

=MMULT(K4:S12,U4:U12)is entered in the top cell W4, and upon pressing Ctrl+Shift+Enter, the solution appears incells W4:W12. It is understood that T

1

= W4, T

2

= W5, etc. The worksheet can be modifiedto provide this nomenclature.

Finally, if one is interested, a check on the calculations may be made by executing theproduct [A][T] in the cells Y4:Y12. This is performed by activating these cells and enteringthe formula

=MMULT(W4:W12,A4:I12)

57−

7326_C005.fm Page 101 Tuesday, March 7, 2006 6:19 AM

Page 117: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

102

What Every Engineer Should Know About Excel

in the cell Y4. The results in column Y should agree with those in column U. Note theagreement, except that cells Y7 and Y8 are not quite equal to zero because of roundofferrors in the calculation process.

It is not necessary to display the coefficients of the inverse function [A]

1

as an interme-diate step in the solution process. Instead, one may go directly to the solution as shown

FIGURE 5.7

1

2

3456789

10111213

T U V W X Y Z AA

-15.625 17.86873 -15.625-31.25 19.51926 -31.25

-146.25 29.93323 -146.250 51.18759 -1.42109E-140 54.59206 1.42109E-14

-100 67.86016 -100-115 77.69751 -115-100 79.80123 -100-200 86.91535 -200

ConstantMatrix [C]

TemperatureSolution [T]=[AInverse][C]

CalculationCheck[A][T]=(?)[C]

1

2

3456789

101112

A B C D E F G H I J

-5.425 1.15 0 1.15 0 0 0 0 01.15 -10.85 1.15 0 2.3 0 0 0 0

0 1.15 -10.85 0 0 2.3 0 0 01.15 0 0 -4.6 2.3 0 1.15 0 0

0 1 0 1 -4 1 0 1 00 0 1 0 1 -4 0 0 10 0 0 1.15 0 0 -4.6 2.3 00 0 0 0 1 0 1 -4 10 0 0 0 0 1 0 1 -4

Coefficient Matrix [A]

1

2

3456789

10111213

K L M N O P Q R S

-0.2064954 -0.0295189 -0.0055597 -0.0750357 -0.0764172 -0.0263757 -0.0271975 -0.0388174 -0.0162983-0.0295189 -0.1060276 -0.0147595 -0.0332249 -0.0994788 -0.0382086 -0.0168771 -0.0394262 -0.0194087-0.0055597 -0.0147595 -0.1004679 -0.0114677 -0.0382086 -0.0731032 -0.0070862 -0.0194087 -0.023128-0.0750357 -0.0332249 -0.0114677 -0.3207477 -0.2610108 -0.0862158 -0.111424 -0.1436907 -0.0574766-0.0332249 -0.0432517 -0.0166124 -0.113483 -0.4119678 -0.1305054 -0.0624742 -0.1568759 -0.0718453-0.0114677 -0.0166124 -0.031784 -0.0374851 -0.1305054 -0.325752 -0.0249898 -0.0718453 -0.0993993-0.0271975 -0.0168771 -0.0070862 -0.111424 -0.1436907 -0.0574766 -0.2935502 -0.2221934 -0.0699175-0.0168771 -0.0171418 -0.0084386 -0.0624742 -0.1568759 -0.0718453 -0.0966058 -0.3725415 -0.1110967-0.0070862 -0.0084386 -0.0100556 -0.0249898 -0.0718453 -0.0993993 -0.0303989 -0.1110967 -0.302624

[A Inverse ]= MINVERSE(A4:I12)

7326_C005.fm Page 102 Tuesday, March 7, 2006 6:19 AM

Page 118: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations

103

in the second worksheet of Figure 5.8. In this case, the inverse and matrix multiplicationoperations are performed by activating the nine cells G19:G27 to reserve space for thesolution and entering the following combination formula in cell G19:

=MMULT(MINVERSE(A4:I12,D19:D22)Note that the constant matrix [C] has been moved to D19:D27 strictly as a page orga-

nization measure. Nomenclature for the T’s has been added in cells F19:F27.

5.5.1 Error Messages

If any of the cells in [A] are left open, MINVERSE will return the #VALUE! error value.It will also return this same error notice if the array does not have an equal number ofrows and columns, i.e., if it is not a square array. If the determinant of [A] is zero, it isnoninvertible and will return the #NUM! error value.

5.6 Solutions of Simultaneous Nonlinear Equations Using Solver

Excel Solver may be used to solve simultaneous linear or nonlinear equations. The equa-tions are first written in the form:

FIGURE 5.8

1

234567891011121314

15

16

17

1819202122232425262728

A B C D E F G H I J

-5.425 1.15 0 1.15 0 0 0 0 01.15 -10.85 1.15 0 2.3 0 0 0 0

0 1.15 -10.85 0 0 2.3 0 0 01.15 0 0 -4.6 2.3 0 1.15 0 0

0 1 0 1 -4 1 0 1 00 0 1 0 1 -4 0 0 10 0 0 1.15 0 0 -4.6 2.3 00 0 0 0 1 0 1 -4 10 0 0 0 0 1 0 1 -4

-15.625 T1= 17.86873-31.25 T2= 19.51926

-146.25 T3= 29.933230 T4= 51.187590 T5= 54.59206

-100 T6= 67.86016-115 T7= 77.69751-100 T8= 79.80123-200 T9= 86.91535

Coefficient Matrix [A]

ConstantMatrix [C]

Temperature Solution[T]=[A Inverse][C]=MMULT(MINVERSE(A4:I12),D19:D27)

7326_C005.fm Page 103 Tuesday, March 7, 2006 6:19 AM

Page 119: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

104

What Every Engineer Should Know About Excel

f

1

(x

1

, x

2

, …, x

n

) = 0

f

2

(x

1

, x

2

, …, x

n

) = 0

f

n

= 0 (5.5)

In the equation set (Equation 5.5) there will be n equations in n unknowns. As noted,the equations may be linear or nonlinear. A new function g(x

1

, x

2

, …, x

n

) is formed such that

g = f

12

+ f

22

+ … + f

n2

(5.6)

The solution technique is to allow Excel Solver to iterate on values of x

1

, x

2

, etc., to causethe function g to approach zero. Because of the squares in the f functions, they too willapproach zero and result in a solution for the set of equations. An alternate formulationwould be to express g as a sum of the absolute values of the f function through g =

∑ABS(fi(xi)). For nonlinear equations, multiple sets of solutions may result (includingcomplex solutions), hence restrictions must be placed on the iterative process to matchthe physical problem represented by the equations. For example, a solution to a heat-transfer problem involving absolute temperatures would require that all the temperaturesbe positive. These restrictions must be inserted when formulating the problem.

The following is a suggested procedure for setting up the Excel worksheet to accomplishthe solution:

1. In column A, type x1=, x2=, etc., for n rows.2. In column B, adjacent to column A of step 1, insert initial estimates for values of

x1, x2, etc., for n rows. These guesses should be made in accordance with the bestestimate of the solution for the physical problem represented by the equations.

3. Skip a few rows, then in column A type f1=, f2=, etc., for n rows, where the fs arein the form of a set of equations (Equation 5.5).

4. In column B, adjacent to column A of step 3, type functions (=… ) according tothe equation set (Equation 5.5). Use cell locations from step 2 for designating thevariables.

5. Skip a few rows.6. In column A type g=.7. In column B and the same row as step 6, type (=… ) function according to Equation

5.6. Use cell designations for the functions from step 4.8. Click TOOLS/SOLVER. Note that if Solver is not present, it must be installed as

an add-in. The target cell is that of the function in step 7. Set this target cell equalto zero by changing cells in column B of step 2. Constraints are set according tophysical problems. As noted, if absolute temperatures were the variables in athermal problem, ≥0 might be set as the constraint.

9. A description of TOOLS/SOLVER/OPTIONS is given in Excel Help/Index underSolver, “dialog of box options”. Select options as appropriate.

10. Click Solve. A solution may or may not be obtained. If not, try repeating Solveagain. Often, this will produce a solution. Or, alternate initial estimates for thevariables in step 2 may be selected and the Solve procedure repeated. A solution

7326_C005.fm Page 104 Tuesday, March 7, 2006 6:19 AM

Page 120: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 105

usually results. If too high a “precision” is specified, Solver may state that asolution is not found when, in fact, one has been found but not to the precisionselected. The person formulating the physical problem must make a judgmentcall in such cases. One should not ask for unreasonable limits of precision whenthe uncertainties of the physical problem do not justify them.

Example 5.3: Solution of a Set of Algebraic EquationsThe worksheet and Solver Windows are shown in Figure 5.9 and Figure 5.10 for solutionsof the following set of nonlinear equations:

x1 + 3x2 – 6x32 = −47

7x1 − 5x23 + x3 = −30

2x12 + 4x2 – 6x3 = −8

FIGURE 5.9

3456789

10111213141516171819202122232425

A B C Dx1= 1.00016655744427x2= 2.00002196974879x3= 3.00001005919001

f1= =B3+3*B4-6*B5^2+47f2= =7*B3-5*B4^3+B5+30f3= =2*B3^2+4*B4-6*B5+8

g= =B8^2+B9^2+B10^2

7326_C005.fm Page 105 Tuesday, March 7, 2006 6:19 AM

Page 121: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

106 What Every Engineer Should Know About Excel

The resulting values of the f and g functions are also given. For this problem, theconstraint of B3:B5≥0 (positive values) was selected. The exact solutions are x1 = 1, x2 = 2,and x3 = 3. The first set of solutions was obtained for a selected precision of 0.01, whereasthe second was for a precision of 0.0001. Note the difference in solutions and the valuesof the f and g functions.

Example 5.4: Radiation and Convection Heat Transfer between Two PlatesA schematic of the system is shown in Figure 5.11. The temperature on the outside of theleft plate is Ta, and the temperature on the outside of the right plate is Tb. The plates havedifferent thickness and conductivities. Heat is conducted through each plate and dissi-pated to the fluid. A fluid moves through the space between the plates at temperature Tf,and the inner surfaces of the plates exchange heat with each other by radiation energy,which is proportional to the absolute temperature to the fourth power. In addition, the

FIGURE 5.10

7326_C005.fm Page 106 Tuesday, March 7, 2006 6:19 AM

Page 122: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 107

plates lose heat by convection to the fluid. The convection coefficients are proportional totemperature difference to the 0.25 power.

The energy balance on each inside surface is given in Equation (a) and Equation (b)along with the temperature dependence of Eb1, Eb2, h1, and h2 in Equation (b) throughEquation (f). Our objective is to determine the temperatures of the inside surfaces of thewalls, T1 and T2.

1000(Ta − T1) + h1(Tf − T1) + (Eb2 − Eb1)/2.25 = 0 (a)

5000(Tb − T2) + h2(Tf − T2) + (Eb1 − Eb2)/2.25 = 0 (b)

Eb1 = 5.67E-8 × T14 (c)

Eb2 = 5.67E-8 × T24 (d)

h1 = 1.6 × (ABS(T1 − Tf))0.25 (e)

h2 = 1.6 × (ABS(T2 − Tf))0.25 (f)

The purpose of this example is to illustrate the solution of nonlinear equations, so weask the reader to accept the format of the equations as given. Detailed information onheat-transfer formulations is available in Reference 4.

The Excel worksheet is set up as shown in Figure 5.12, with the six variables located atB4:B9. The outside wall temperatures and fluid temperature are entered in column E withthe values that are assigned for this particular case. Other values may be selected if theeffects of different boundary conditions are to be examined. Equation (a) and Equation(b) are already in the correct format [ƒ(…) = 0], so they are entered in the worksheet atcells B11 and B12. The g function

g = f12 + f2

2

FIGURE 5.11

Ta Tb

T1 T2

Flow, Tf

Heat

7326_C005.fm Page 107 Tuesday, March 7, 2006 6:19 AM

Page 123: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

108 What Every Engineer Should Know About Excel

is entered in cell B14. This is the target cell that we want to iterate to zero by changingvalues of T1 and T2 in cells B4 and B5.

Examining Equation (a) through Equation (f), we see that the formulas in B6:B9 couldhave been incorporated in the formulas for f1 and f2. We choose to list them separatelyso that the calculated values of these quantities will become part of the solution presen-tation. The boundary temperatures in E4:E6 could also be inserted in the formulas, butby using this type of display they also become part of the solution presentation.

(a)

(b)

FIGURE 5.12

12345678910111213

A B C D E

T1= 301 Ta= 773T2= 302 Tb= 373h1= =1.6*(ABS(B4-E6))^0.25 Tf= 300h2= =1.6*(ABS(B5-E6))^0.25Eb1= =0.0000000567*B4^4Eb2= =0.0000000567*B5^4

f1= =1000*(E4-B4)+B6*(E6-B4)+(B9-B8)/2.25f2= =500*(E5-B5)+B7*(E6-B5)+(B8-B9)/2.25

456789

1011121314

A B C D ET1= 761.6657 Ta= 773T2= 387.9586222 Tb= 373h1= 7.416549249 Tf= 300h2= 4.899926743Eb1= 19082.73647Eb2= 1284.472149

f1= -0.006067138f2= 0.037811483

0 001466518

7326_C005.fm Page 108 Tuesday, March 7, 2006 6:19 AM

Page 124: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 109

The formula displays are removed from the screen and the Solver window called byTOOLS/SOLVER. This window is shown in Figure 5.12c. From the physical nature of theproblem it can be inferred that the minimum temperature in the two walls must alwaysbe greater than the fluid temperature Tf = 300 K; hence, the constraints are as shown inthe Solver window. The initial guesses of 301 and 302 for T1 and T2 are shown at B4 andB5 of the formula window in Figure 5.12a. All temperatures are expressed in absolute(degrees kelvin) because of the radiation terms.

After setting the target cell as B14 = 0, Solve is clicked, and the results are shown inFigure 5.12b. Note the small value of g, i.e., 0.001467 ≈ 0.

Example 5.5: Solution of Simultaneous Linear Equations Using SolverThe procedure for solving a set of linear equations with Solver is the same as that fornonlinear equations. First, the equations must be written in the form ƒ(x1, …, xn) = 0.For this example, we choose the same set of equations that was solved by iteration inExample 5.1.

The listing of the T variables from B1 through B9 is shown in the worksheet in Figure5.13a. The equations for the ƒ functions are listed from B12 through B20 in this worksheet.Finally, the g function is listed as the sum of the squares of the ƒ functions in cell B22. Theinitial guesses for the T variables are all taken as zero in cells B1 through B9.

Solver is then called by clicking TOOLS/SOLVER, and the Solver Parameters windowappears as in Figure 5.13c. The target cell that contains the g function is B22, which is setto zero. The cells to be changed for the iteration process are those of the variables in B1:B9.The constraint that the solutions be greater than or equal to zero is added. Solve is thenclicked and a solution is found that appears as in Figure 5.13b. All the ƒ functions andthe g function have small values. The solutions for the T variables agree with the valuesobtained previously.

Although the use of Solver to obtain a solution to simultaneous linear equations is quitesatisfactory, it is more cumbersome to use than the iterative technique of Section 5.4.

(c) FIGURE 5.12 (continued)

7326_C005.fm Page 109 Tuesday, March 7, 2006 6:19 AM

Page 125: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

110 What Every Engineer Should Know About Excel

5.7 Solver Results Dialog Box

The Solver Results dialog box for the solutions of the three nonlinear equations of Example5.3 is shown in Figure 5.14. By checking Keep Solver Solution and then OK, the solutionswill be displayed in the variable cells B3:B5, as shown. Solver provides an additionalfeature under the Report box. If Answer is checked, a summary answer report is generated,and will appear as a separate Answer Report sheet in the workbook. Clicking Sensitivitywill produce a separate Sensitivity Report sheet in the workbook. These reports arepreformatted in a style suitable for presentation or transfer to another document. The two

FIGURE 5.13

7326_C005.fm Page 110 Tuesday, March 7, 2006 6:19 AM

Page 126: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 111

reports for the current example are shown in Figure 5.14 along with the Results dialogbox. Further information regarding this feature is available in Help/Index under Aboutthe Solver Results dialog box. We will find that the reports are quite useful when presentingthe results of optimization problems in Chapter 8.

5.8 Comparison of Methods for Solution of Simultaneous Linear Equations

Three methods have been demonstrated for solution of simultaneous linear equations:(1) an iterative technique particularly applicable to sets of equations with sparse coef-ficient matrices and described in Section 5.4, (2) an iterative technique using Excel Solverdescribed in Section 5.6, and (3) solution by matrix inversion as described in Section5.5. In physical problems the constants in [C] often represent boundary conditionsimposed on the problem, which may be varied to investigate their effects on the finalsolution. Their display in the separate matrix offers the advantage of somewhat moreconvenient adjustments than when they are embedded in the equations for an iterativesolution. Elements of the constant matrix may be expressed in terms of other celladdresses that may, in turn, be varied as desired for examination of different physicalboundary conditions.

FIGURE 5.14

Target Cell (Value Of)Cell Name OriginalValue FinalValue

$B$12 g= 3173 5.1842E-07

Adjustable CellsCell Name OriginalValue FinalValue

$B$3 x1= 0 1.00016656$B$4 x2= 0 2.00002197$B$5 x3= 0 3.00001006

ConstraintsCell Name CellValue Formula Status Slack

$B$3 x1= 1.000166557 $B$3>=0 Not Binding 1.00016656$B$4 x2= 2.00002197 $B$4>=0 Not Binding 2.00002197$B$5 x3= 3.000010059 $B$5>=0 Not Binding 3.00001006

Adjustable CellsFinal Reduced

Cell Name Value Gradient$B$3 x1= 1.00016656 0$B$4 x2= 2.00002197 0$B$5 x3= 3.00001006 0

ConstraintsNONE

Answer Report

Sensitivity Report

7326_C005.fm Page 111 Tuesday, March 7, 2006 6:19 AM

Page 127: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

112 What Every Engineer Should Know About Excel

For relatively large numbers of equations with sparse coefficient matrices, a large num-ber of zeros must be entered. Over half the entries are zero in the nine-equation example(Example 5.2). An error of just one entry will result in an incorrect solution. In these cases,the iterative technique is probably the most convenient solution method. Although not asvisible as in the matrix method, the boundary conditions represented as constant termsin the equations may still be referred to variable cell locations and changed as needed inthe physical problem.

5.9 Copying Cell Equations for Repetitive Calculations

The drag-copy feature of Excel is very useful in applications in which repetitive calcula-tions must be performed sequentially based on a previous result. One application is thatof transient-heat-transfer analysis using finite-difference equations. The problem is usuallyformulated with the following nodal equation:

Tip+1 = (Δτ/Ci)∑ [(Tj

p – Tip)/Rij] + Ti

p

where Tp represents temperatures at the beginning of a time increment, and Tp+ representsnodal temperatures after a time increment Δτ. A calculation of the transient temperatureresponse of the object is performed by applying this equation sequentially to every nodein the solid for as many time increments as desired. If the calculation is carried forwardto a large number of time increments, the steady-state temperature distribution will beobtained. Different initial conditions may be examined very easily by changing the tem-peratures that start the calculation at time zero.

Excel is used to advantage by writing the cell (temperature node ) formulas in referenceaddress form and then copying them for as many time increments as needed. In this way,the p + 1 node is always specified in terms of the p node preceding it in the worksheet.The procedure for this application is then:

1. Select the number of time increments for the solution of the problem and set thenumber of rows required for setup equal to the number of time increments minusone. Twenty time increments will require 21 rows.

2. Enter the initial temperature conditions in the first row.3. Enter nodal equations in the worksheet in the required format, starting with row

2. Use TOOLS/OPTIONS/VIEW/FORMULAS to display formulas in the bodyof the worksheet. Check carefully to see that the formulas are correct.

4. Copy (drag the mouse) cell formulas down for the number of rows selected instep 1.

5. Print out formulas, if desired, by using FILE/PAGE SETUP/SHEET/Row andColumn Headings; then print using the usual procedure.

6. Return to TOOLS/OPTIONS/VIEW/WINDOW/FORMULA and remove thecheck. The temperature distribution will be displayed on the worksheet. Print outas needed.

7. The problem may be worked for other initial conditions by returning to step 2and entering new values. The new solutions will appear immediately.

7326_C005.fm Page 112 Tuesday, March 7, 2006 6:19 AM

Page 128: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 113

A simple numerical example of this method is given below. The reader unfamiliar withheat-transfer nomenclature should not be concerned with the formulas used, but insteadobserve the behavior of the solution and the way the drag-copy operation is performed.

Example 5.6: Transient Temperature Distribution in a 1-D SolidA one-dimensional slab is initially at a uniform temperature. The temperature of the leftsurface is suddenly changed to 100°C, while that of the right surface is suddenly changedto 200°C. Determine the temperature distribution at four positions in the solid using (Δx)2/αΔτ = 2 and a sufficient number of time increments to achieve steady state. Obtain solutionsfor initial temperatures of 0°C, 200°C, 300°C, and 1000°C.

SOLUTIONWhen the transient parameter is selected as given the nodal equations become (see Ref-erence 4 for an explanation of this parameter):

Tp+1(m) = (1/2)[Tp(m + 1) + Tp(m − 1)]

where m + 1 and m − 1 refer to the temperatures to the right and left of node m, respectively.Or, for row two of the worksheet, we have

A2 = (100 + B1)/2; B2 = (A1 + C1)/2; C2 = (B1 + D1)/2; D2 = (C1 + 200)/2

The equations are shown in Figure 5.15, and the numerical results are given in Figure5.16 in the accompanying printouts for 40 time increments (41 rows), which is sufficientin all cases to achieve the steady-state values of 120°, 140°, 160°, and 180°C. Note thatwith the use of the drag-copy, the relative address feature expresses the temperatures ineach row in terms of the temperatures in the previous row. Each row represents a timeincrement. The specific value of the time increment would depend on the parameters Δxand α, which are not defined in the problem statement.

5.10 Creating and Running Macros

A macro is a sequence of operations with keystrokes and mouse actions that may berecorded and stored for repeated use. The procedure for creating macros in Excel is mosteasily demonstrated with a specific example.

Example 5.7: Macro to solve f(x)-0Create a macro to obtain the roots to f(x) = 0, where f(x) appears in cell B4 of the worksheet.Obtain the solution using Goal Seek, iterating the values of x contained in cell B3. Oncethe macro is created, different functions may be entered in B4 and a solution obtainedwith a single click action.

The procedure is as follows:

1. Set up a worksheet for the way it will be used — in this case, for a Goal Seeksolution of the function in cell B4, with variable x in cell B3. If any toolbars are

7326_C005.fm Page 113 Tuesday, March 7, 2006 6:19 AM

Page 129: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

114 What Every Engineer Should Know About Excel

required, see that they are displayed at this time by clicking VIEW/TOOLBARS/DRAWING, etc.

2. This step consists of the following actions:a. Click TOOLS/MACRO/Record New Macro. The Record Macro dialog box

will appear as shown in Figure 5.17. Assign a name to the macro (Marcro1, inthis case). The first character of the macro name must be a letter, followed byyour choice of other letters, numbers, or symbols. Spaces are not permitted,but an underscore may be used instead of a space between words.

FIGURE 5.15

1234567891011121314151617181920212223242526272829303132333435363738394041

A B C D0 0 0 0=(100+B1)/2 =(A1+C1)/2 =(B1+D1)/2 =(C1+200)/2=(100+B2)/2 =(A2+C2)/2 =(B2+D2)/2 =(C2+200)/2=(100+B3)/2 =(A3+C3)/2 =(B3+D3)/2 =(C3+200)/2=(100+B4)/2 =(A4+C4)/2 =(B4+D4)/2 =(C4+200)/2=(100+B5)/2 =(A5+C5)/2 =(B5+D5)/2 =(C5+200)/2=(100+B6)/2 =(A6+C6)/2 =(B6+D6)/2 =(C6+200)/2=(100+B7)/2 =(A7+C7)/2 =(B7+D7)/2 =(C7+200)/2=(100+B8)/2 =(A8+C8)/2 =(B8+D8)/2 =(C8+200)/2=(100+B9)/2 =(A9+C9)/2 =(B9+D9)/2 =(C9+200)/2=(100+B10)/2 =(A10+C10)/2 =(B10+D10)/2 =(C10+200)/2=(100+B11)/2 =(A11+C11)/2 =(B11+D11)/2 =(C11+200)/2=(100+B12)/2 =(A12+C12)/2 =(B12+D12)/2 =(C12+200)/2=(100+B13)/2 =(A13+C13)/2 =(B13+D13)/2 =(C13+200)/2=(100+B14)/2 =(A14+C14)/2 =(B14+D14)/2 =(C14+200)/2=(100+B15)/2 =(A15+C15)/2 =(B15+D15)/2 =(C15+200)/2=(100+B16)/2 =(A16+C16)/2 =(B16+D16)/2 =(C16+200)/2=(100+B17)/2 =(A17+C17)/2 =(B17+D17)/2 =(C17+200)/2=(100+B18)/2 =(A18+C18)/2 =(B18+D18)/2 =(C18+200)/2=(100+B19)/2 =(A19+C19)/2 =(B19+D19)/2 =(C19+200)/2=(100+B20)/2 =(A20+C20)/2 =(B20+D20)/2 =(C20+200)/2=(100+B21)/2 =(A21+C21)/2 =(B21+D21)/2 =(C21+200)/2=(100+B22)/2 =(A22+C22)/2 =(B22+D22)/2 =(C22+200)/2=(100+B23)/2 =(A23+C23)/2 =(B23+D23)/2 =(C23+200)/2=(100+B24)/2 =(A24+C24)/2 =(B24+D24)/2 =(C24+200)/2=(100+B25)/2 =(A25+C25)/2 =(B25+D25)/2 =(C25+200)/2=(100+B26)/2 =(A26+C26)/2 =(B26+D26)/2 =(C26+200)/2=(100+B27)/2 =(A27+C27)/2 =(B27+D27)/2 =(C27+200)/2=(100+B28)/2 =(A28+C28)/2 =(B28+D28)/2 =(C28+200)/2=(100+B29)/2 =(A29+C29)/2 =(B29+D29)/2 =(C29+200)/2=(100+B30)/2 =(A30+C30)/2 =(B30+D30)/2 =(C30+200)/2=(100+B31)/2 =(A31+C31)/2 =(B31+D31)/2 =(C31+200)/2=(100+B32)/2 =(A32+C32)/2 =(B32+D32)/2 =(C32+200)/2=(100+B33)/2 =(A33+C33)/2 =(B33+D33)/2 =(C33+200)/2=(100+B34)/2 =(A34+C34)/2 =(B34+D34)/2 =(C34+200)/2=(100+B35)/2 =(A35+C35)/2 =(B35+D35)/2 =(C35+200)/2=(100+B36)/2 =(A36+C36)/2 =(B36+D36)/2 =(C36+200)/2=(100+B37)/2 =(A37+C37)/2 =(B37+D37)/2 =(C37+200)/2=(100+B38)/2 =(A38+C38)/2 =(B38+D38)/2 =(C38+200)/2=(100+B39)/2 =(A39+C39)/2 =(B39+D39)/2 =(C39+200)/2=(100+B40)/2 =(A40+C40)/2 =(B40+D40)/2 =(C40+200)/2

7326_C005.fm Page 114 Tuesday, March 7, 2006 6:19 AM

Page 130: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 115

FIG

UR

E 5.

16

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

AB

CD

EF

GH

IJ

KL

MN

OP

QR

S0

00

020

020

020

020

030

030

030

030

010

0010

0010

0010

0050

00

100

150

200

200

200

200

300

300

250

550

1000

1000

600

5025

5010

015

017

520

020

020

025

027

525

055

077

580

060

062

.550

62.5

125

137.

517

518

7.5

200

175

237.

525

023

7.5

437.

567

568

7.5

500

7562

.587

.513

1.25

137.

516

2.5

187.

519

3.75

168.

7521

2.5

237.

522

538

7.5

562.

558

7.5

443.

7581

.25

81.2

596

.875

143.

7513

1.25

162.

517

8.12

519

3.75

156.

2520

3.12

521

8.75

218.

7533

1.25

487.

550

3.12

539

3.75

90.6

2589

.062

511

2.5

148.

4375

131.

2515

4.68

7517

8.12

518

9.06

2515

1.56

2518

7.5

210.

9375

209.

375

293.

7541

7.18

7544

0.62

535

1.56

2594

.531

2510

1.56

2511

8.75

156.

2512

7.34

3815

4.68

7517

1.87

518

9.06

2514

3.75

181.

2519

8.43

7520

5.46

8825

8.59

3836

7.18

7538

4.37

532

0.31

2510

0.78

1310

6.64

0612

8.90

6315

9.37

512

7.34

3814

9.60

9417

1.87

518

5.93

7514

0.62

517

1.09

3819

3.35

9419

9.21

8823

3.59

3832

1.48

4434

3.75

292.

1875

103.

3203

114.

8438

133.

0078

164.

4531

124.

8047

149.

6094

167.

7734

185.

9375

135.

5469

166.

9922

185.

1563

196.

6797

210.

7422

288.

6719

306.

8359

271.

875

107.

4219

118.

1641

139.

6484

166.

5039

124.

8047

146.

2891

167.

7734

183.

8867

133.

4961

160.

3516

181.

8359

192.

5781

194.

3359

258.

7891

280.

2734

253.

418

109.

082

123.

5352

142.

334

169.

8242

123.

1445

146.

2891

165.

0879

183.

8867

130.

1758

157.

666

176.

4648

190.

918

179.

3945

237.

3047

256.

1035

240.

1367

111.

7676

125.

708

146.

6797

171.

167

123.

1445

144.

1162

165.

0879

182.

5439

128.

833

153.

3203

174.

292

188.

2324

168.

6523

217.

749

238.

7207

228.

0518

112.

854

129.

2236

148.

4375

173.

3398

122.

0581

144.

1162

163.

3301

182.

5439

126.

6602

151.

5625

170.

7764

187.

146

158.

8745

203.

6865

222.

9004

219.

3604

114.

6118

130.

6458

151.

2817

174.

2188

122.

0581

142.

6941

163.

3301

181.

665

125.

7813

148.

7183

169.

3542

185.

3882

151.

8433

190.

8875

211.

5234

211.

4502

115.

3229

132.

9468

152.

4323

175.

6409

121.

347

142.

6941

162.

1796

181.

665

124.

3591

147.

5677

167.

0532

184.

6771

145.

4437

181.

6833

201.

1688

205.

7617

116.

4734

133.

8776

154.

2938

176.

2161

121.

347

141.

7633

162.

1796

181.

0898

123.

7839

145.

7062

166.

1224

183.

5266

140.

8417

173.

3063

193.

7225

200.

5844

116.

9388

135.

3836

155.

0468

177.

1469

120.

8817

141.

7633

161.

4265

181.

0898

122.

8531

144.

9532

164.

6164

183.

0612

136.

6531

167.

2821

186.

9453

196.

8613

117.

6918

135.

9928

156.

2653

177.

5234

120.

8817

141.

1541

161.

4265

180.

7133

122.

4766

143.

7347

164.

0072

182.

3082

133.

6411

161.

7992

182.

0717

193.

4727

117.

9964

136.

9785

156.

7581

178.

1326

120.

577

141.

1541

160.

9337

180.

7133

121.

8674

143.

2419

163.

0215

182.

0036

130.

8996

157.

8564

177.

636

191.

0358

118.

4893

137.

3773

157.

5556

178.

3791

120.

577

140.

7554

160.

9337

180.

4668

121.

6209

142.

4444

162.

6227

181.

5107

128.

9282

154.

2678

174.

4461

188.

818

118.

6886

138.

0224

157.

8782

178.

7778

120.

3777

140.

7554

160.

6111

180.

4668

121.

2222

142.

1218

161.

9776

181.

3114

127.

1339

151.

6871

171.

5429

187.

2231

119.

0112

138.

2834

158.

4001

178.

9391

120.

3777

140.

4944

160.

6111

180.

3056

121.

0609

141.

5999

161.

7166

180.

9888

125.

8436

149.

3384

169.

4551

185.

7714

119.

1417

138.

7057

158.

6112

179.

2001

120.

2472

140.

4944

160.

418

0.30

5612

0.79

9914

1.38

8816

1.29

4318

0.85

8312

4.66

9214

7.64

9316

7.55

4918

4.72

7511

9.35

2813

8.87

6515

8.95

2917

9.30

5612

0.24

7214

0.32

3616

0.4

180.

212

0.69

4414

1.04

7116

1.12

3518

0.64

7212

3.82

4714

6.11

2116

6.18

8418

3.77

7511

9.43

8213

9.15

2815

9.09

117

9.47

6412

0.16

1814

0.32

3616

0.26

1818

0.2

120.

5236

140.

909

160.

8472

180.

5618

123.

056

145.

0066

164.

9448

183.

0942

119.

5764

139.

2646

159.

3146

179.

5455

120.

1618

140.

2118

160.

2618

180.

1309

120.

4545

140.

6854

160.

7354

180.

4236

122.

5033

144.

0004

164.

0504

182.

4724

119.

6323

139.

4455

159.

4051

179.

6573

120.

1059

140.

2118

160.

1713

180.

1309

120.

3427

140.

5949

160.

5545

180.

3677

122.

0002

143.

2768

163.

2364

182.

0252

119.

7228

139.

5187

159.

5514

179.

7025

120.

1059

140.

1386

160.

1713

180.

0857

120.

2975

140.

4486

160.

4813

180.

2772

121.

6384

142.

6183

162.

651

181.

6182

119.

7593

139.

6371

159.

6106

179.

7757

120.

0693

140.

1386

160.

1121

180.

0857

120.

2243

140.

3894

160.

3629

180.

2407

121.

3091

142.

1447

162.

1182

181.

3255

119.

8185

139.

685

159.

7064

179.

8053

120.

0693

140.

0907

160.

1121

180.

0561

120.

1947

140.

2936

160.

315

180.

1815

121.

0724

141.

7137

161.

7351

181.

0591

119.

8425

139.

7625

159.

7451

179.

8532

120.

0454

140.

0907

160.

0734

180.

0561

120.

1468

140.

2549

160.

2375

180.

1575

120.

8568

141.

4037

161.

3864

180.

8676

119.

8812

139.

7938

159.

8078

179.

8726

120.

0454

140.

0594

160.

0734

180.

0367

120.

1274

140.

1922

160.

2062

180.

1188

120.

7019

141.

1216

161.

1356

180.

6932

119.

8969

139.

8445

159.

8332

179.

9039

120.

0297

140.

0594

160.

048

180.

0367

120.

0961

140.

1668

160.

1555

180.

1031

120.

5608

140.

9188

160.

9074

180.

5678

119.

9223

139.

8651

159.

8742

179.

9166

120.

0297

140.

0389

160.

048

180.

024

120.

0834

140.

1258

160.

1349

180.

0777

120.

4594

140.

7341

160.

7433

180.

4537

119.

9325

139.

8982

159.

8908

179.

9371

120.

0194

140.

0389

160.

0314

180.

024

120.

0629

140.

1092

160.

1018

180.

0675

120.

3671

140.

6013

160.

5939

180.

3716

119.

9491

139.

9117

159.

9177

179.

9454

120.

0194

140.

0254

160.

0314

180.

0157

120.

0546

140.

0823

160.

0883

180.

0509

120.

3007

140.

4805

160.

4865

180.

297

119.

9558

139.

9334

159.

9285

179.

9588

120.

0127

140.

0254

160.

0206

180.

0157

120.

0412

140.

0715

160.

0666

180.

0442

120.

2402

140.

3936

160.

3887

180.

2432

119.

9667

139.

9422

159.

9461

179.

9643

120.

0127

140.

0166

160.

0206

180.

0103

120.

0357

140.

0539

160.

0578

180.

0333

120.

1968

140.

3145

160.

3184

180.

1944

119.

9711

139.

9564

159.

9532

179.

9731

120.

0083

140.

0166

160.

0135

180.

0103

120.

0269

140.

0468

160.

0436

180.

0289

120.

1572

140.

2576

160.

2544

180.

1592

119.

9782

139.

9622

159.

9647

179.

9766

120.

0083

140.

0109

160.

0135

180.

0067

120.

0234

140.

0353

160.

0378

180.

0218

120.

1288

140.

2058

160.

2084

180.

1272

Tra

nsie

ntT

empe

ratu

resi

na

Slab

Row

1lis

tsin

itial

tem

pera

ture

sof0

,200

,300

,and

1000

Not

etha

tlon

gtim

etem

pera

ture

sapp

roac

hsa

mev

alue

sfo

rall

initi

alco

nditi

ons(

Row

41)

.

7326_C005.fm Page 115 Tuesday, March 7, 2006 6:19 AM

Page 131: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

116 What Every Engineer Should Know About Excel

b. If desired, a shortcut key may be assigned for the macro at this time. The keymust take the form of Ctrl + letter. Numbers are not permitted.

c. Specify the storage place of the macro. “This Workbook” is chosen for thisexample. If the macro is to be available for all Excel workbooks, store it in thePersonal Macro Workbook in the XLStart folder.

d. Enter a description of the macro.3. Click OK. The Stop Rec dialog box should appear as shown in Figure 5.17. If it

does not appear, click VIEW/TOOLBARS/Stop Record. If no action is taken, therecording of the macro will be based on absolute cell references. Click the relativecell button to record on a relative cell basis. If desired, the absolute and relativereference cell basis may be alternated during the recording process.

4. Execute the procedure to obtain the roots. In this case, the solution to B4 = 0 isperformed as shown in the discussion of Goal Seek solutions. Obviously, thesolution to this example is very simple (B3 = 6). When the procedure executionis completed, click Stop in the Stop Rec box, or click TOOLS/MACRO/StopRecording.a. If the recording is done on an absolute cell basis (relative cell button not

clicked), the solution will be obtained for B4 = 0 by changing the values of B3.The solution appears in B3 and the residual value of f(x) appears in B4.

b. If the macro is recorded on a relative cell basis (relative cell button activated),the function cell must be activated (clicked) before starting the macro. For

FIGURE 5.17

7326_C005.fm Page 116 Tuesday, March 7, 2006 6:19 AM

Page 132: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 117

example, if the function is entered in cell M9, that cell should be activated.The solution will then appear in the cell just above (or M8), therefore that cellshould be reserved for display of the solution or initial guesses for the iterativeGoal Seek calculation.

5. The macro is executed by pressing the shortcut key assigned (Ctrl + letter) or byclicking TOOLS/MACRO/MACROS/select Macro1, then click Run. In addition,the macro may be attached to an object or button on the worksheet that will runthe macro when clicked. Two examples are shown in Figure 5.18 for this macro.a. A rectangle drawing object is created at B6 and the macro name Macro1

typed inside. The macro is assigned by activating the rectangle, right clicking,and then followed by Assign Macro with Macro1 selected in the dialog box.

b. A special button is created at B8 by clicking VIEW/TOOLBARS/FORMS/Button (second row, second column). The Assign Macro box will appear. Makethe assignment and then click OK. The button will remain activated; if not,activate by pressing Ctrl while clicking on the periphery of the button. Typethe title of the macro in the button using a desired style and font.

c. For both the rectangle and button, click FORMAT/CONTROL/PROPERTIES/select choice for object (button) positioning. If object (button) is to be shownon the printout of the worksheet, click Print Object.

Click X in the Forms dialog box to remove it from the screen.

Example 5.8: Solution of the Transcendental Equation from Section 5.2Create the aforementioned macro and apply it to the solution for the roots of the tran-scendental equation in Section 5.2. Note that the transcendental equation x tanx – 2 hasmultiple roots. Use several initial guesses (both positive and negative) in cell B3 to producevalues of these roots. Initial guesses of 1.0, 2.0, and 10.0 produce results of 1.07684, 3.64361,and 9.62964, respectively. Initial guesses of −1.0, −2.0, and −10.0 will display the corre-sponding negative values for the roots.

FIGURE 5.18

23456789

A B

x=f(x)= =B3-6

Macro 1

Macro1

7326_C005.fm Page 117 Tuesday, March 7, 2006 6:19 AM

Page 133: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

118 What Every Engineer Should Know About Excel

Problems

5.1 Solve the following equations using both Goal Seek and Solver:

a. x = 0.09[1 − (1+x)−n] for n = 5, 10, 15, and 20b. 4x3 − 3x2 + 2x − 87 = 0c. xsinx − 1 = 0d. xe−0.1x = 1e. x3 − (0.647)2[(1 − x)2(2 + x)] = 0f. 3.587(1 + 0.04x2/3) = 0.0668xg. 8.3(302 − x) = 5.102 × 10−8(x4 − 278)h. 4.74(300 − x)1/4 + 5.102 × 10−8(5004 − x4) = 0

5.2 Solve the following sets of linear equations using both the iterative technique andmatrix inversion:

a. 10x2 + 10x5 + 12.5 = 21.25x1

5x1 + 5x3 + 10x6 + 12.5 = 21.25 x2

5x2 + 5x4 + 10x7 + 12.5 = 21.25x3

10x3 + 12.5 = 11.25x4

10x1 + 50x6 + 12000 = 100x5

25x5 + 25x7 + 10x2 + 12000 = 100x6

50x6 + 20x3 = 70x7

b. 1100 + x3 + x4 = 4x1

600 + x3 + x4 = 4x2

900 + x1 + x2 = 4x3

800 + x1 + x2 = 4x4

c. 75 + 2x5 +x2/4 + 16 = 3.3x1

x1/4 + x3/4 + 2x6 + 16 = 3.3x2

x2/4 +x4/4 + 2x7 + 16 = 3.3x3

x3/4 + x8 + 8 + 4 = 1.85x4

4x1 + x6/2 + 150 = 5x5

4x2 + x7/2 + x5/2 = 5x6

4x3 + x6/2 + x8/2 = 5x7

2x4 + x7/2 + 5 = 2.9x8

d. x2/2 + 50 + 16x3 =17.75x1

x1/2 + 16x4 +50 = 17.75x2

x4 + 100 + 16x5 + 16x1 = 34x3

x3 + 100 + 16x6 + 16x2 = 34x4

7326_C005.fm Page 118 Tuesday, March 7, 2006 6:19 AM

Page 134: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Solution of Equations 119

x6/2 + 50 + 16x3 = 17x5

x5/2 + 50 + 16x4 = 17x6

e. (57000 − x1)/4 + (460 − x1)/90 + (x2 − x1)/19 = 0(x1 − x2)/19 + (460 − x2)/31 + (x3 − x2)/64 = 0(460 − x3)/8 +(x2 − x3)/64 = 0

5.4 Solve the following sets of nonlinear equations using Solver:a. 1300(T2 − T1) + 1.42[ABS(300 − T1)]1/4 + 5.7 × 10−8(3004 − T1

4) = 0T3 + T1 − 2T2 = 0500 + T2 − 2T3 = 0with the restriction that 300 < T < 500

b. 1300[1 + 0.00025(T2 + T1)](T2 − T1) + 1.42[ABS(300 − T1)]1/4 + 5.7×10-8(3004 − T14

= 0[1 + 0.00025(T3 + T2)](T3 − T2) + [1 + 0.00025(T1 + T2)](T1 − T2) = 0[1 + 0.00025(1000+T3)](1000 − T3) + [1 + 0.00025(T2 + T3)](T2 − T3) = 0with the restriction that 300 < T < 1000

c. x12 + sinx − 2x2 = 1.4674

x1x2 + x23 = 2.5708

with the restriction that x1, x2 > 0

d. x12 + x2

2 = 5x1 + 3x2 = 7x2 + x3

2 − x1 =5for all x > 0

e. 3.38 − p + [(101.3 − p))(310 − T)]/(1538 − T) = 0ln(p/2337) = 6789(1/293.15 − 1/T)p and T are positive values

5.5 The following set of equations describes the performance of a crossflow finned-tube heat exchanger:

e = 1 − exp{[exp(−NCn) − 1]/Cn}

n = N−0.22 C = 2100/Cmin

DTh = 0.67e DTh = 40300/Cmin N = 2100/Cmin

Determine the values of the six variables. All values must be positive.

5.6 The temperature ratio in a pin fin is described by the equation

Tr = [cosh m(L − x) + (h/mk)sinh m(L − x)]/[cosh mL + (h/mk)sinh mL]

7326_C005.fm Page 119 Tuesday, March 7, 2006 6:19 AM

Page 135: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

120 What Every Engineer Should Know About Excel

where m = (hP/kA)1/2; P = πd; A = πd2/4

In a fin with d = 0.01 m, and L = 0.1 m, the temperature ratios are measured attwo x locations giving

Tr = 0.56 at x = 0.04 m

Tr = 0.365 at x = 0.08 m

Using Solver, determine the values of h and k.

5.7 The amplitude response for a seismic instrument is described by the equation:

a = x2/[(1-x2)2 + (2Cx)2]1/2

where x = ω/ωn, C = c/cc, cc = (4mk)1/2, and ωn = (k/m)1/2

Three amplitude measurements are taken giving:

a = 0.98 at ω = 75 Hz

a = 2 at ω = 100 Hz

a = 1.5 at ω = 166 Hz

Using these data and Solver, determine values of m and k.

7326_C005.fm Page 120 Tuesday, March 7, 2006 6:19 AM

Page 136: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

121

6

Other Operations

6.1 Introduction

In this chapter, we gather some operations that do not fall easily into the topics coveredin other chapters. These items are:

1. Numerical integration2. Use of logical IF function3. Histograms4. Normal error (probability) distributions5. Calculation of uncertainty propagation in experiments6. Multivariable linear and exponential regression analysis with LINEST and

LOGEST worksheet functions7. Examples and comparison of regression methods

Examples are given for each topic and some coordination between the use of histograms,cumulative frequency distributions, and the normal error distributions is presented.

6.2 Numerical Evaluation of Integrals

Numerical evaluation of integrals may be performed in Excel by using either the trape-zoidal rule or Simpson’s rule. First, the area under the curve y =

ƒ

(x) is divided intoincrements of

Δ

x. In the trapezoidal rule the curve is replaced by a series of straight linesegments, and the area of each element under the curve is calculated as a product of themean height and the width

Δ

x. Thus,

A

i

=

Δ

x(y

i

+ y

i+1

)/2

Taking the variables as ranging from 1 to n in indices, the total area under the curvewill be

I =

ydx = A = (1/2)(y

1

+ 2y

2

+ … + 2y

n

1

+ y

n

)

Δ

x

= [(y

1

+ y

n

)/2 +

y

i

]

Δ

x (6.1)

7326_C006.fm Page 121 Tuesday, March 7, 2006 6:19 AM

Page 137: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

122

What Every Engineer Should Know About Excel

where the sum is carried out from i = 2 to i = n

1.If the increments in x are not uniform the elemental areas are

A

i

= y

m

Δ

x

i

= (y

i

+ y

i+1

)(x

i+1

x

i

)/2 (6.2)

The total area under the curve is then obtained by summing all the elemental areas.Simpson’s rule fits a series of parabolas to consecutive sets of three points on the curve

such that the area may be calculated from

I =

ydx = (y

1

+ 4y

2

+ 2y

3

+ 4y

4

+ 2y

5

+ … +2y

n-2

+4y

n

1

+ y

n

)

Δ

x/3 (6.3)

for uniform increments in x. If the area under the curve is divided into an even numberof equally spaced values of

Δ

x, the integral becomes

I = {y

i

+ y

n

+

y

i

[3 + (

1)

i+1

]}

×

Δ

x/3 (6.4)

where the summation is performed from i = 2 to i = n – 1. For an even number of incrementsin

Δ

x, the number of data points will be odd.The larger the number of increments in x, the better will be the approximation of the

integral.

Example 6.1: Integration of Sine function

The worksheets shown in Figure 6.1 are set up to calculate the integral of sin(x) overthe interval of 0 < x <

π

. The exact value of the integral is equal to -cos(x) evaluatedfrom 0 to

π

radians, which gives

(

1

1), or an exact value of 2.0. The worksheet isarranged to allow for different values of the increment

Δ

x, which is assigned in cell I4.We will present the results for two

Δ

x increments:

π

/10 and

π

/22. In both cases we havean even number of increments, so Equation 6.4 is used for evaluation with Simpson’srule. In Figure 6.1a, values of x are listed for the 26-increment case in column A, startingwith zero and stepping up by increments specified in cell I4. Column B calculates thecorresponding values of sin(x).

The first area (or integral) calculation is made using the trapezoidal rule of Equation6.1. Half the values of y

1

and y

n

are entered in cells C4 and C26, respectively, whereas theother y-values are copied in cells C5:C25 from cells B5:B25. Cell C29 then calculates thesum of the cells C4:C26 multiplied by the

Δ

x increment to yield an area of 1.9966002(

0.016999% error) as shown in Figure 6.1c.For the calculation using Simpson’s rule, the “i” index is created in column E and the

arguments of the summation of Equation 6.4 are computed in cells F4:F26. Cell C29 thensums the entries of column F and multiplies by

Δ

x/3 in accordance with Equation 6.4.The result for the calculated area is 2.00000462 (0.000231% error).

The same calculation is made for 10 increments in x, and the results are displayed inFigure 6.1b. Use of fewer increments gives an area of 1.9835235 (

0.823825% error) for thetrapezoidal rule and 2.0001095179 (0.005476% error) when Simpson’s rule is applied. Inboth cases, Simpson’s rule is more accurate than the trapezoidal rule.

Example 6.2: Numerical Integration of Experimental Data

We now examine a hypothetical set of experimental data shown as the variables x and yat the top left of the worksheet of Figure 6.2. The data are expected to follow a linearvariation and hence are plotted on a linear x-y scatter graph as shown in Figure 6.2a

7326_C006.fm Page 122 Tuesday, March 7, 2006 6:19 AM

Page 138: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

123

through Figure 6.2d. The graph in Figure 6.2a is a type 4 scatter graph with straight linesegments joining the data points, the graph in Figure 6.2b is a type 3 scatter graph witha computer-smoothed curve joining the points, and the graph in Figure 6.2c is a type 1scatter graph. The graph in Figure 6.2d is the same as that in Figure 6.2c but with theaddition of a linear trendline fit for the data.

FIGURE 6.1

(a)

123456789101112131415161718192021222324252627282930

A B C D E F G H ITrapezoidal Rule Simpson's Rule

x y = SIN(x) Index

0 =SIN(A4) =B4/2 1 =B4 Dx= =PI()/22=A4+$I$4 =SIN(A5) =B5 =E4+1 =B5*(3+(-1)^E5 Pi/22)=A5+$I$4 =SIN(A6) =B6 =E5+1 =B6*(3+(-1)^E6)=A6+$I$4 =SIN(A7) =B7 =E6+1 =B7*(3+(-1)^E7)=A7+$I$4 =SIN(A8) =B8 =E7+1 =B8*(3+(-1)^E8)=A8+$I$4 =SIN(A9) =B9 =E8+1 =B9*(3+(-1)^E9)=A9+$I$4 =SIN(A10) =B10 =E9+1 =B10*(3+(-1)^E10)=A10+$I$4 =SIN(A11) =B11 =E10+1 =B11*(3+(-1)^E11)=A11+$I$4 =SIN(A12) =B12 =E11+1 =B12*(3+(-1)^E12)=A12+$I$4 =SIN(A13) =B13 =E12+1 =B13*(3+(-1)^E13)=A13+$I$4 =SIN(A14) =B14 =E13+1 =B14*(3+(-1)^E14)=A14+$I$4 =SIN(A15) =B15 =E14+1 =B15*(3+(-1)^E15)=A15+$I$4 =SIN(A16) =B16 =E15+1 =B16*(3+(-1)^E16)=A16+$I$4 =SIN(A17) =B17 =E16+1 =B17*(3+(-1)^E17)=A17+$I$4 =SIN(A18) =B18 =E17+1 =B18*(3+(-1)^E18)=A18+$I$4 =SIN(A19) =B19 =E18+1 =B19*(3+(-1)^E19)=A19+$I$4 =SIN(A20) =B20 =E19+1 =B20*(3+(-1)^E20)=A20+$I$4 =SIN(A21) =B21 =E20+1 =B21*(3+(-1)^E21)=A21+$I$4 =SIN(A22) =B22 =E21+1 =B22*(3+(-1)^E22)=A22+$I$4 =SIN(A23) =B23 =E22+1 =B23*(3+(-1)^E23)=A23+$I$4 =SIN(A24) =B24 =E23+1 =B24*(3+(-1)^E24)=A24+$I$4 =SIN(A25) =B25 =E24+1 =B25*(3+(-1)^E25)=A25+$I$4 =SIN(A26) =B26/2 =E25+1 =B26

AREA= =(SUM(C4:C26))*I4 AREA= =(SUM(F4:F26))*I4/3

(b)

12345678910111213141516

A B C D E F G H ITrapezoidal Rule Simpson's Rule

x y = SIN(x) Index

0 0 0 1 0 Dx= 0.3141592650.314159 0.309016994 0.309017 2 1.236067977 (Pi/10)0.628319 0.587785252 0.5877853 3 1.1755705050.942478 0.809016994 0.809017 4 3.2360679771.256637 0.951056516 0.9510565 5 1.9021130331.570796 1 1 6 41.884956 0.951056516 0.9510565 7 1.9021130332.199115 0.809016994 0.809017 8 3.2360679772.513274 0.587785252 0.5877853 9 1.1755705052.827433 0.309016994 0.309017 10 1.2360679773.141593 1.22515E-16 6.126E-17 11 1.22515E-16

AREA= 1.9835235 AREA= 2.000109517

7326_C006.fm Page 123 Tuesday, March 7, 2006 6:19 AM

Page 139: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

124

What Every Engineer Should Know About Excel

If a linear plot is expected from either physical reasoning or previous experience, thenFigure 6.2d may be the preferred vehicle for presentation of the data. It is interesting toperform a numerical integration of the data over the range 0 < x < 5 with increments

Δ

x = 0.5, the same as used for the data increments.The integration is performed similar to that of the sine function in Figure 6.1 using both

the trapezoidal rule and Simpson’s rule. In Figure 6.3a the formulas are displayed, whereasin Figure 6.3b the computed values of the integral in cell C19 for the trapezoidal integrationand in cell F19 for Simpson’s rule are shown. The computed values are 24.15 and23.8666667, respectively. It is interesting to compare these numbers with those obtainedby integrating over the trendline of Figure 6.2d.

The trendline is represented by

y = 1.9145x + 0.0318

and the area under the curve by

Area =

ydx = [1.9145x

2

/2 + 0.0318x] = 24.09025

This value compares favorably with the results obtained in the numerical integrationshown earlier, and may be the best representation of the data because it is determined bythe trendline fit. The smoothed curve in Figure 6.2b is probably unrealistic, and the scatterof the data is best taken into account by the least-squares trendline fit in Figure 6.2d.

FIGURE 6.1

(continued)

(c)

1234567891011121314151617181920212223242526272829

A B C D E F G H ITrapezoidal Rule Simpson's Rule

x y = SIN(x) Index

0 0 0 1 0 Dx= 0.1427996660.142799666 0.142314838 0.142314838 2 0.569259353 (Pi/22)0.285599332 0.281732557 0.281732557 3 0.5634651140.428398998 0.415415013 0.415415013 4 1.6616600520.571198664 0.540640817 0.540640817 5 1.081281635

0.71399833 0.654860734 0.654860734 6 2.6194429360.856797996 0.755749574 0.755749574 7 1.5114991490.999597663 0.841253533 0.841253533 8 3.3650141311.142397329 0.909631995 0.909631995 9 1.8192639911.285196995 0.959492974 0.959492974 10 3.8379718941.427996661 0.989821442 0.989821442 11 1.9796428841.570796327 1 1 12 41.713595993 0.989821442 0.989821442 13 1.9796428841.856395659 0.959492974 0.959492974 14 3.8379718941.999195325 0.909631995 0.909631995 15 1.8192639912.141994991 0.841253533 0.841253533 16 3.3650141312.284794657 0.755749574 0.755749574 17 1.5114991492.427594323 0.654860734 0.654860734 18 2.6194429362.570393989 0.540640817 0.540640817 19 1.0812816352.713193655 0.415415013 0.415415013 20 1.6616600522.855993321 0.281732557 0.281732557 21 0.5634651142.998792988 0.142314838 0.142314838 22 0.5692593533.141592654 1.01069E-15 5.05347E-16 23 1.01069E-15

AREA= 1.99660022 AREA= 2.000004631

05

7326_C006.fm Page 124 Tuesday, March 7, 2006 6:19 AM

Page 140: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

125

6.3 Use of Logical IF Statement

The IF statement enables a branching of calculations based on a true or false result of alogical test. The function takes the form:

IF (logical test, go to ____ if test is true, or go to_____if test is false)

Example 6.3: Nested IF Statements and Embedded Documentation

Figure 6.4

shows the worksheet for a calculation that uses two nested IF functions (sevenare permitted) to choose the proper calculation equation for flat-plate heat-transfer coef-ficients. The three equations are listed in mathematical format in the block at the bottomof the sheet, along with restrictions on their range of applicability in terms of the Re

L

parameter. This block was composed in Word and then copied to the Excel worksheet.The equations are written in Excel format in cells C14, C15, and C16. The value of the Reparameter (Reynolds number) that determines which equation is to be used is calculated

FIGURE 6.2

x y

0 0.20.5 0.7

1 2.11.5 2.2

2 4.62.5 4.8

3 5.43.5 7

4 8.24.5 8.6

5 9.2

0

1

2

3

4

5

6

7

8

9

10

0 1 2 3 4 5

0

1

2

3

4

5

6

7

8

9

10

0 1 2 3 4 5

0

1

2

3

4

5

6

7

8

9

10

0 1 2 3 4 5

y= 1.9145x+ 0.0318

R2

= 0.9823

0

2

4

6

8

10

12

0 1 2 3 4 5

7326_C006.fm Page 125 Tuesday, March 7, 2006 6:19 AM

Page 141: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

126

What Every Engineer Should Know About Excel

FIGURE 6.3

(a)

1

23

45

6

78

910

11

1213

1415

16

1718

19

A B C D E FTrapezoidal Simpson'sRule Rule

x y Index

0 0.2 =B6/2 1 =B6

0.5 0.7 =B7 =E6+1 =B7*(3+(-1)^E 7)1 2.1 =B8 =E7+1 =B8*(3+(-1)^E 8)

1.5 2.2 =B9 =E8+1 =B9*(3+(-1)^E 9)2 4.6 =B10 =E9+1 =B10*(3+(-1)^E 10)

2.5 4.8 =B11 =E10+1 =B11*(3+(-1)^E 11)

3 5.4 =B12 =E11+1 =B12*(3+(-1)^E 12)3.5 7 =B13 =E12+1 =B13*(3+(-1)^E 13)

4 8.2 =B14 =E13+1 =B14*(3+(-1)^E 14)4.5 8.6 =B15 =E14+1 =B15*(3+(-1)^E 15)

5 9.2 =B16/2 =E15+1 =B16

AREA= =(SUM(C6:C16))*0.5 AREA = =(SUM(F6:F16))*0.5/3

(b)

123

4

5

6

7

8

9

10

11

12

13

14

15

1617181920

A B C D E FTrapezoidal Simpson'sRule Rule

x y Index

0 0.2 0.1 1 0.2

0.5 0.7 0.7 2 2.8

1 2.1 2.1 3 4.2

1.5 2.2 2.2 4 8.8

2 4.6 4.6 5 9.2

2.5 4.8 4.8 6 19.2

3 5.4 5.4 7 10.8

3.5 7 7 8 28

4 8.2 8.2 9 16.4

4.5 8.6 8.6 10 34.4

5 9.2 4.6 11 9.2

AREA= 24.15 AREA = 23.8666667

7326_C006.fm Page 126 Tuesday, March 7, 2006 6:19 AM

Page 142: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

127

FIGURE 6.4

FIGURE 6.5

2345678910111213141516171819202122232425262728293031323334353637

B C DFLAT PLATE HEAT TRANSFER

Valu nitsrho= density, kg/m^3mu= viscosity, kg/m-su= free streamvelocity, m/sL= late length, mk= 0.03 thermalconductivity, W/m-KPr= 0.7 PrandtlnumberRe= =C1 eynoldsnumberA= 0. late Area, m^2Re= =C5*C7*C8/C6 Calculationof Rehavg= =(C9/C8)*0.664*(C11^0.5)*C10^0.3333 Laminar havg for Re<5E5havg= =(C9/C8)*(C10^0.3333)*(0.037*(C11^0.8)-871) Turbulent havg for 5E5<Re<1E7havg= =(C9/C8)*(C10^0.3333)*(0.228*C11*((LOG(C11)) -̂2.584)-871) Turbulent havg for Re>1E7havg,calc= =IF(C11<500000,C14,IF(C11<10000000,C15,C16)) Calculated avg heat transfer coeff., W/m^2-K

Tw= 555 Plate surface temp, KTs= 222 Free streamtemp, Kq= =C22*C12*(C19-C20) Heat lost byplate, Whavg= =C1 value for q calc

CellC14 calculates the average heat transfer coefficient according to Eq.(5-46) of Holman:HEAT TRANSFER 8/e for Re<5E5CellC15 calculates the average hvalue according to Eq. (5-85) for 5E5<Re<1E7CellC16 calculates the average hvalue according to Eq.(5-85a) for 1E7<Re<1E9CellC17 selects the proper calculationdepending onthe value of Re listed incellC11. Re iscalculated inCellC13Heat lost bythe plate iscalculated incellC21 fromq = (havg)(Area)(Tw-Ts)

havg = (k/L) 0.664Re L1/2

Pr1/3

forRe L> 105

(5-46b)

havg = (k/L) Pr1/3 (0.037Re L0.8 - 871) for 10 5 < Re L < 10 7 (5-85)

havg = (k/L) [0.228Re L(logRe L)-2.584 - 871]Pr 1/3 for 10 7 <Re L < 10 9 (5-85a)

1234

A

=IF(A3>3,"YES","NO")

1234

A

2NO

1234

A

4YES

7326_C006.fm Page 127 Tuesday, March 7, 2006 6:19 AM

Page 143: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

128

What Every Engineer Should Know About Excel

in cell C11. Verbal expressions of the actions called by the two IF statements are given asfollows:

The first (outer) IF statement is

If the value in C11 is < 5E5 (true test result) go to cell C14 for the calculation.If the value in C11 is not < 5E5 (false test result) go to the next (inner) IF statement.

The second (inner) IF statement is

If the value of C11 is < 1E7 (true test result) [and also > 5E5 from the first IFstatement], go to cell C15 for the calculation.If the value in C11 is not < 1E7 (false test result) go to cell C16 for the calculation.

Example 6.4: Use of IF Statement to Return Comments

The logical IF statement may be used to return a written comment instead of a calculationaction as described in Example 6.3. In the example shown here in Figure 6.4 the numericalvalue in cell A3 is tested. If the value is greater than 3, the comment YES is displayedin cell A4. If the value in cell A3 is less than 3 (i.e., the logical test is false), the commentNO is displayed in cell A4. The IF statement formula is shown along with two specificcases — for A3 = 2 (<3, false result) NO is displayed in A4 and for A3 = 4 (>3, trueresult) YES is displayed in A4. If rather long comments are to be displayed, it is probablybetter to have a short reference comment such as “See text box number 1,” etc., as theoutput of the IF statement.

6.4 Histograms and Cumulative Frequency Distributions

Histograms are, very simply, a way of compartmentalizing various sets of data. Thus wemight construct a histogram that listed new cars in

bins

, or compartments according totheir base MSRP prices, or their weight, or their engine displacement. A histogram for adigital camera provides a visual display that shows the distribution of light across thevisual spectrum. Excel provides a means for arranging data in such histograms.

Example 6.5: Student Test Scores

The use of Excel for producing histograms and cumulative frequency distributions for aset of data will be demonstrated by analyzing a hypothetical set of student scores. Thesescores are shown in column B of Figure 6.6, along with a student-identifying number incolumn A. We wish to display the distribution of grades in 10-point ranges (or bins) of90 to 100, 80 to 90, 70 to 80, 60 to 70, 50 to 60, and below 50. We specify the upper boundof each range (bin) as shown in cells D3:D7. The selection of 79.9, 89.9, etc., forces gradessuch as 80 or 90 to fall in the next higher bin.

The Excel procedure is as follows with the data as shown in column B of Figure 6.6:

1. Histogram analysis, similar to Solver, is part of an add-in Analysis ToolPak. If itis not present, add it by clicking TOOLS/ADD-INS/ANALYSIS TOOLPAK.

2. After ToolPak is installed and data entered in the worksheet, click TOOLS/DATAANALYSIS/HISTOGRAM. The Histogram dialog box will appear as shown inFigure 6.6.

7326_C006.fm Page 128 Tuesday, March 7, 2006 6:19 AM

Page 144: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

129

3. Either select the data (column B of Figure 6.6) with the mouse, or type them inthe input range in the dialog box. Do not click OK without performing theremaining steps noted below.

4. The upper bound of each bin is listed in column D. Enter this range with themouse or by typing the range in the space provided in the Histogram dialogbox of Figure 6.7.

5. The output range is selected to begin with cell F3, which is to the right of thebin ranges.

Enter F3 in the dialog box. If OK on the dialog box is clicked at thistime, the output information in columns F and G will appear as shown on theworksheet.

FIGURE 6.6

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253

A B C D E F G H I J KStudent Score Bin Upper Output Other ParametersNumber Bound (calculated)

1 22 49.9 Bin Frequency Cumulative%2 99 59.9 49.9 2 5.26% Mean= 77.8684213 100 69.9 59.9 3 13.16% STDEV= 16.4089154 86 79.9 69.9 6 28.95% STDEVP= 16.1915695 76 89.9 79.9 7 47.37% Median= 826 69 89.9 10 73.68% Max= 1007 98 More 10 100.00% Min= 228 569 72

10 8311 8412 8313 9714 4215 5616 6317 6918 9219 8720 8921 6822 7523 7824 7925 7726 83 (a)27 9528 9129 9230 9031 5932 6233 8634 9035 8536 8137 7638 69

(b)

Histogram

0

2

4

6

8

10

12

49.9 59.9 69.9 79.9 89.9 MoreBin

Fre

quen

cy

Frequency

Histogram

0

2

4

6

8

10

12

49.959.9

69.979.9

89.9M

ore

Bin

Fre

qu

ency

.00%

20.00%

40.00%

60.00%

80.00%

100.00%

120.00%

Frequency

Cumulative%

7326_C006.fm Page 129 Tuesday, March 7, 2006 6:19 AM

Page 145: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

130

What Every Engineer Should Know About Excel

6. A bar graph output may be obtained by returning to the Histogram dialog box(or never leaving it) and checking the Chart Output box. If a cumulative fre-quency output is desired, that box should be checked also (ignore the Paretobox). The bar graph without the cumulative frequency information is shown inFigure 6.6a. Addition of the cumulative distribution check mark produces thebar graph shown in Figure 6.6b and an added column H for the cumulativepercentage. The upper bound of each bin is indicated by the tick marks on theabscissa of each graph.

7. Calculation of other parameters of interest is presented in columns J and K. Excelfunctions were employed for most of these calculation as shown in the display ofthe formulas in Figure 6.8. STDEV calculates the sample standard deviation,whereas STDEVP calculates the population standard deviation. They are verynearly equal for 38 data points. An alternative way to calculate the arithmetic

FIGURE 6.7

FIGURE 6.8

3456789

10

J K

Mean= =(SUM(B3:B40))/38STDEV= =STDEV(B3:B40)STDEVP= =STDEVP(B3:B40)Median= =MEDIAN(B3:B40)Max= =MAX(B3:B40)Min= =MIN(B3:B40)

7326_C006.fm Page 130 Tuesday, March 7, 2006 6:19 AM

Page 146: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

131

mean is to use the Excel AVERAGE function. Cell K4 would then become [=AVER-AGE(B3:B40)].

In this example the scores are weighted toward the higher grades. It must be a goodclass! Gap widths for the column charts may be adjusted as described in Section 3.19. Theresult is shown in Figure 6.9.

FIGURE 6.9

Student Score Bin Upper Output Other ParametersNumber Bound (calculated)

1 22 49.9 Bin Frequency Cumulative%2 99 59.9 49.9 2 5.26% Mean= 77.8684213 100 69.9 59.9 3 13.16% STDEV= 16.4089154 86 79.9 69.9 6 28.95% STDEVP= 16.1915695 76 89.9 79.9 7 47.37% Median= 826 69 89.9 10 73.68% Max= 1007 98 More 10 100.00% Min= 228 569 72

10 8311 8412 8313 9714 4215 5616 6317 6918 9219 8720 8921 6822 7523 7824 7925 7726 83

(a)

27 9528 9129 9230 9031 5932 6233 8634 9035 8536 8137 7638 69

(b)

Histogram

0

2

4

6

8

10

12

49.9 59.9 69.9 79.9 89.9 MoreBin

Fre

quen

cy

Frequency

Histogram

0

2

4

6

8

10

12

49.959.9

69.979.9

89.9M

ore

Bin

Fre

qu

ency

.00%

20.00%

40.00%

60.00%

80.00%

100.00%

120.00%

FrequencyCumulative%

7326_C006.fm Page 131 Tuesday, March 7, 2006 6:19 AM

Page 147: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

132

What Every Engineer Should Know About Excel

Example 6.6: Use of Histograms to Curve Student Grades

If one were to take 10 points per letter grade for the class scores in Example 6.5, the gradedistribution would be

A 10B 10C 7D 6F 5

where F’s are assumed for scores below 60. If the distribution of grades followed a normalprobability distribution (and there is no reason it should or must follow such a distribu-tion), it could be argued that the largest number of the average letter grade of C shouldcluster around the arithmetic mean score of 77.9, with somewhat fewer grades in the Band D category and still fewer grades in the A and F groups. In this case there would bea peak frequency of grades in the C bin (group). Such a distribution can be somewhat“forced” by taking bin widths centered around the mean score of 77.9. The bins may bewidened until a histogram develops that appears to be a normal distribution.

In Figure 6.10a,

±

5 points have been added to the mean score of 77.9 to create the bin forthe C grade. The upper bound for that bin then becomes 82.9 and the lower bound becomes72.9, which is also the upper bound for the D scores. Another

±

5 points are then added toestablish the upper bound for the B score and lower bound for the D grades. The resultinghistogram is shown in the figure, but it still does not resemble a “normal” distribution.

In Figure 6.10b,

±

8 points have been added to the average score of 77.9 to produceupper and lower bounds for the C grades of 85.9 and 69.9, respectively. Another

±

8 pointsare added to produce the upper bound for the B grades of 93.9 and lower bound for Dsof 61.9. In this case the histogram at least takes on the appearance of a normal distribution.There would be 5 As and 5 Fs, 9 Bs and 6 Ds, and 13 Cs assigned if this scheme were used.

Finally,

±

10 points were added to the average score of 77.9 to produce the bounds ofthe C bin and another

±

10 to establish the bounds for the D and B grades. The resultsare shown in Figure 6.10c. Again, the appearance of a normal-type distribution is dis-played, but with much heavier weighting on the C grades.

Whether one would use any of the preceding techniques to assign final grades is amatter of conjecture, which must be decided by an experienced instructor for the course.Nevertheless, this example does show how histogram plots may be employed to view aset of data from different perspectives.

6.5 Normal Error Distributions

The Gaussian or normal error distribution is defined by

ƒ

(x, x

m

,

σ

) = (1/2

πσ

2

)

1/2

×

EXP[

(x

x

m

)

2

/2

σ

2

] (6.5)

where

x = value for evaluation of function

7326_C006.fm Page 132 Tuesday, March 7, 2006 6:19 AM

Page 148: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations

133

x

m

= arithmetic mean of the distribution = SUM(x

i

)/n or calculated with the function AVERAGE(x

1

, x

2

, …, x

n

)n = number of x-values

σ

= standard deviation for the set of x-values

and

ƒ

is called the

probability density function.

The function is normalized so that

FIGURE 6.10

(a)

Bin Frequency Cumulative %67.9 7 18.42%72.9 5 31.58%82.9 7 50.00%87.9 8 71.05%

More 11 100.00%

Histogram

0

2

4

6

8

10

12

67.9 72.9 82.9 87.9 MoreBin

Fre

quen

cy

0

0.2

0.4

0.6

0.8

1

1.2

(b)

Bin Frequency Cumulative %61.9 5 13.16%69.9 6 28.95%85.9 13 63.16%93.9 9 86.84%

More 5 100.00%

Histogram

0

2

4

6

8

10

12

14

61.9 69.9 85.9 93.9 More

Bin

Fre

quen

cy

0

0.2

0.4

0.6

0.8

1

1.2

7326_C006.fm Page 133 Tuesday, March 7, 2006 6:19 AM

Page 149: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

134

What Every Engineer Should Know About Excel

ƒ

(x)dx = 1.0 for

−∞

< x < +

(6.6)

The

cumulative frequency

is defined by

ƒ

(x)dx for limits from

−∞

to x (6.7)

The normal distribution function is called with

NORMDIST (x,mean,standard dev,cumulative)

where “mean” is the arithmetic mean of the set of data and “standard dev” is the standarddeviation for that data. For “cumulative” the word “true” is entered for a calculation ofthe cumulative frequency according to Equation 6.7, whereas the word “false” is enteredto return a computation of the probability density according to Equation 6.5. For the specialcase of x

m

= 0 and standard dev = 1.0, the function returns the value of the standardnormal distribution. That same distribution may be called with the function

NORMSDIST(x,cumulative)

The inverse function

NORMINV(probability,mean,standard dev)

returns the value of x corresponding to the arguments in the function syntax.

FIGURE 6.10 (continued)

(c)

Bin Frequency Cumulative %57.9 4 10.53%67.9 3 18.42%87.9 20 71.05%97.9 8 92.11%

More 3 100.00%

Histogram

0

5

10

15

20

25

57.9 67.9 87.9 97.9 More

BinF

requ

ency

0

0.2

0.4

0.6

0.8

1

1.2

−∞

+∞

−∞∫x

7326_C006.fm Page 134 Tuesday, March 7, 2006 6:19 AM

Page 150: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 135

Example 6.6: Application of Normal Distribution and Inverse FunctionsFor practice purposes some quick examples of application of the normal distribution andinverse functions are given as:

NORMDIST(5,0,3,FALSE) = 0.0807

NORMDIST(5,0,3,TRUE) = 0.9522

NORMDIST(2,0,1,TRUE) = 0.9772 = NORMDIST(2)

NORMINV(0.9772,0,1) = 2

The calculations and graphs in Figure 6.11 and Figure 6.12 show the density functionand cumulative frequency for an arithmetic mean xm = 0 and standard deviations of 1, 3,and 5. The density functions exhibit the familiar bell curve distribution that results whena large number of samples are taken. The tabulation and plots are made for the range −20 < x < +20. The density function reaches a nearly zero value by x = ± 15.

The chart in Figure 6.12 showing the cumulative frequency plot indicates that, for allvalues of standard deviation, half the values lie above and half lie below the arithmeticmean. For a sufficiently large value of x, all cumulative frequency distribution curvesapproach a value of 1.0, i.e., all of the values of x are included.

Following the charts of frequencies and probability densities is an example that com-pares the cumulative frequency of the student scores examined in Example 6.5 with thatof a normal distribution having the same mean and standard deviation:

FIGURE 6.11

x StdDev = 5 StdDev = 3 StdDev = 1

-20 2.6766E-05 2.9703E-11 5.52095E-88-19 5.83894E-05 2.59282E-10 1.62464E-79-18 0.00012238 2.02529E-09 1.75875E-71-17 0.000246444 1.41563E-08 7.00418E-64-16 0.000476818 8.85434E-08 1.02616E-56-15 0.00088637 4.95573E-07 5.53071E-50-14 0.00158309 2.48202E-06 1.09661E-43-13 0.002716594 1.11236E-05 7.99883E-38-12 0.004478906 4.46101E-05 2.14638E-32-11 0.007094919 0.00016009 2.11882E-27-10 0.010798193 0.000514093 7.6946E-23

-9 0.015790032 0.001477283 1.02798E-18-8 0.022184167 0.003798662 5.05227E-15-7 0.029945493 0.00874063 9.13472E-12-6 0.038837211 0.017996989 6.07588E-09-5 0.048394145 0.033159046 1.48672E-06-4 0.057938311 0.054670025 0.00013383-3 0.066644921 0.080656908 0.004431848-2 0.073654028 0.106482669 0.053990967-1 0.078208539 0.125794409 0.2419707250 0.079788456 0.13298076 0.398942281 0.078208539 0.125794409 0.2419707252 0.073654028 0.106482669 0.0539909673 0.066644921 0.080656908 0.0044318484 0.057938311 0.054670025 0.000133835 0.048394145 0.033159046 1.48672E-066 0.038837211 0.017996989 6.07588E-097 0.029945493 0.00874063 9.13472E-128 0.022184167 0.003798662 5.05227E-159 0.015790032 0.001477283 1.02798E-18

10 0.010798193 0.000514093 7.6946E-2311 0.007094919 0.00016009 2.11882E-2712 0.004478906 4.46101E-05 2.14638E-3213 0.002716594 1.11236E-05 7.99883E-3814 0.00158309 2.48202E-06 1.09661E-4315 0.00088637 4.95573E-07 5.53071E-5016 0.000476818 8.85434E-08 1.02616E-5617 0.000246444 1.41563E-08 7.00418E-6418 0.00012238 2.02529E-09 1.75875E-7119 5.83894E-05 2.59282E-10 1.62464E-7920 2.6766E-05 2.9703E-11 5.52095E-88

Normal Probability Function

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

-20 -15 -10 -5 0 5 10 1 0

x

Pro

babi

lity

dens

ity

StdDev = 1

StdDev = 3

StdDev = 5

7326_C006.fm Page 135 Tuesday, March 7, 2006 6:19 AM

Page 151: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

136 What Every Engineer Should Know About Excel

Example 6.7: Comparison of Actual and Normal Cumulative FrequenciesWe have seen how a cumulative frequency plot for a set of data may be viewed in differentperspectives by changing the boundaries of the bins on a histogram. The resulting histo-grams may or may not resemble a normal distribution. Comparison with a normal dis-tribution may be made by taking uniform increments in x and a computation of the normaldistribution having the same mean and standard deviation as that of the data. For thiscomparison we will use the set of student scores discussed previously.

The worksheet of Figure 6.13 lists the scale for the student scores of Example 6.5 incolumn A using two-point increments. The number of student scores up to each point islisted in column D. The cumulative frequency for the student scores is calculated in columnB with =D3/38 because the total number of scores is 38. These entries stop when the scorereaches 100. The cumulative frequency for a normal distribution with the same mean andstandard deviation is computed in column C using mean = 77.868 and standard dev. =16.409. The function is then

=NORMDIST(x,mean,standard dev,cumulative)

=NORMDIST(x,72.868,16.409)

FIGURE 6.12

x StdDev=5 StdDev=3 StdDev=1

-20 3.1686E-05 1.31549E-11 0-19 7.23724E-05 1.20495E-10 0-18 0.000159146 9.90122E-10 0-17 0.000336981 7.30059E-09 0-16 0.000687202 4.83165E-08 0-15 0.001349967 2.87105E-07 0-14 0.002555191 1.53234E-06 0-13 0.004661222 7.34892E-06 0-12 0.008197529 3.1686E-05 0-11 0.013903399 0.000122899 0-10 0.022750062 0.000429117 0-9 0.035930266 0.001349967 0-8 0.054799289 0.003830425 6.66134E-16-7 0.080756711 0.009815307 1.28808E-12-6 0.115069732 0.022750062 9.90122E-10-5 0.15865526 0.04779033 2.87105E-07-4 0.211855334 0.091211282 3.1686E-05-3 0.274253065 0.15865526 0.001349967-2 0.344578303 0.252492467 0.022750062-1 0.420740313 0.369441404 0.158655260 0.5 0.5 0.51 0.579259687 0.630558596 0.841344742 0.655421697 0.747507533 0.9772499383 0.725746935 0.84134474 0.9986500334 0.788144666 0.908788718 0.9999683145 0.84134474 0.95220967 0.9999997136 0.884930268 0.977249938 0.9999999997 0.919243289 0.990184693 18 0.945200711 0.996169575 19 0.964069734 0.998650033 1

10 0.977249938 0.999570883 111 0.986096601 0.999877101 112 0.991802471 0.999968314 113 0.995338778 0.999992651 114 0.997444809 0.999998468 115 0.998650033 0.999999713 116 0.999312798 0.999999952 117 0.999663019 0.999999993 118 0.999840854 0.999999999 119 0.999927628 1 120 0.999968314 1 1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-20 -15 -10 -5 0 5 10 1 0

x

Nor

mal

Dis

trib

utio

nC

umul

ativ

e

StdDev= 1

StdDev = 3

StdDev = 5

7326_C006.fm Page 136 Tuesday, March 7, 2006 6:19 AM

Page 152: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 137

where x is the student score in column A. The functions are drag-copied for the numberof rows needed. For the student scores, the calculation is stopped when a score of 100 isreached, whereas the calculation for the normal distribution is carried past a score of 100to approach a maximum frequency of 1.0. A type 4 scatter chart is employed for thegraphical presentation. The comparison is not bad.

FIGURE 6.13

123456789

1011121314151617181920212223242526272829303132333435363738394041424344454647484950

A B C D E F G H I JScore Frequency Frequency for Cumulative

for Students Normal Distribution Score

22 0.026315789 0.00033151 124 0.026315789 0.000514352 126 0.026315789 0.000787006 128 0.026315789 0.001187602 130 0.026315789 0.00176751 132 0.026315789 0.002594632 134 0.026315789 0.003756985 136 0.026315789 0.005366384 138 0.026315789 0.007561949 140 0.026315789 0.010513059 142 0.052631579 0.014421298 244 0.052631579 0.01952086 246 0.052631579 0.026076885 248 0.052631579 0.034381209 250 0.052631579 0.044745121 252 0.052631579 0.057488922 254 0.052631579 0.072928311 256 0.105263158 0.091357965 458 0.105263158 0.113033027 460 0.131578947 0.138149567 562 0.157894737 0.166825375 664 0.184210526 0.199082674 766 0.184210526 0.234834383 768 0.210526316 0.273875475 870 0.289473684 0.315880686 1172 0.315789474 0.360409399 1274 0.315789474 0.40691794 1276 0.394736842 0.454778902 1578 0.447368421 0.503306469 1780 0.473684211 0.551785047 1882 0.5 0.599501366 1984 0.605263158 0.645775888 2386 0.684210526 0.689991224 2688 0.710526316 0.731616731 2790 0.789473684 0.77022692 3092 0.868421053 0.805512757 3394 0.868421053 0.837285542 3396 0.894736842 0.865473696 3498 0.947368421 0.890113342 36

100 1 0.911333991 38102 0.929340899104 0.944395722106 0.956797049108 0.966862112110 0.974910718112 0.981252051114 0.986174672

Frequency Distribution of StudentScores Compared to Normal

Distrbution

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

20 40 60 80 100 120 140

Score

Cum

ulat

ive

Fre

quen

cy

Students

Normal Distributionwith Same MeanandStandard DeviationasStudents

Mean = 77.868StdDev = 16.409Cumulative Frequency for Normal Distribution was calculatefrom the function NORMDIST(x,mean,standard dev,cumulatThe x values are the student scores.

7326_C006.fm Page 137 Tuesday, March 7, 2006 6:19 AM

Page 153: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

138 What Every Engineer Should Know About Excel

6.6 Calculation of Uncertainty Propagation in Experimental Results

A common calculation in the analysis of experimental data involves the propagation ofuncertainties from the basic measured parameters into a result calculated from thesevariables. The experimentalist must set the values of the uncertainties in the primarymeasurements based on calibration information, manufacturer’s specifications for theinstruments, and the overall laboratory experience. An experimental variable will then beexpressed as

x1 = x1 ± wx1

where wx1 is the uncertainty in x1.The calculated result y is expressed in terms of measured parameters through a known

function ƒ. (It must be known to calculate a result!) Thus,

y = ƒ(x1, x2, …, xn) (6.8)

If the uncertainties in the experimental x-values are all expressed with the same prob-abilities, the uncertainty in y may be calculated with

wy = [(∂ƒ/∂x1)2wx12 + (∂ƒ/∂x2)2wx2

2 + …]1/2 (6.9)

An alternative to performing the partial differentiations is a calculation of the derivativesusing finite-difference approximations. Thus, the partial derivatives are approximated by

(∂ƒ/∂x1) ≈ [ƒ(x1+Δx1, x2, …) − ƒ(x1, x2, …)]/Δx1 (6.10)

where Δx1 ≈ 0.01x1 or some small increment in x1.

Example 6.8: Uncertainty Calculation for Three VariablesThe Excel procedure for making this calculation will be demonstrated by application toa rather simple ƒ function. The procedure is easily extended to more complicated functions.

We assume that y is a function of three experimental variables through the relation

y = x12x2x3 (6.11)

The worksheet is set up as shown in Figure 6.14a, with the numerical values of x’s, tobe entered at B1:B3 and their uncertainties at D1:D3. If the problem involves more param-eters, there would be correspondingly more rows to list the experimental values andassociated uncertainties.

The formula for the y function is written at B6 according to Equation 6.11, using absolutecell references. The formula is then drag-copied to B8:B10 and $B$1 replaced by 1.01*B1,etc. The drag-copy process saves considerable time if a complicated y function is involvedwith many variables. Note that Δx is taken as 0.01x in all cases. This increment should besmall enough to give satisfactory results.

The values of the ∂ƒ/∂x are calculated at D8:D10 using Equation 6.10. Again, the equa-tions may be drag-copied for complicated functions with many variables.

7326_C006.fm Page 138 Tuesday, March 7, 2006 6:19 AM

Page 154: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 139

The values of the ∂ƒ/∂x are copied to E1:E3 for display and convenience purposes andthe values of the (∂ƒ/∂x)2wx

2 computed at F1:F3. Again, drag-copying of the formulas maybe used when many variables are involved.

Finally, wy is computed with Equation 6.9 at D13, and the percentage uncertaintycalculated at cell E13.

The results for numerical values of

x1 = 25 ; x2 = 50 ; x3 = 75

and

FIGURE 6.14

(a)

123456789

10111213

A B C Dx1= wx1= =D8 =(E1*D1)̂ 2x2= wx2= =D9 =(E2*D2)̂ 2x3= wx3= =D10 =(E3*D3)̂ 2

y= =$B$1^2*$B$2*$B$3

=(1.01*B1)^2*$B$2*$B$3 (df/dx)1= =(B8-$B$6)/(0.01*B1)=$B$1^2*1.01*B2*$B$3 (df/dx)2= =(B9-$B$6)/(0.01*B2)=$B$1^2*$B$2*1.01*B3 (df/dx)3= =(B10-$B$6)/(0.01*B3)

wy= =(SUM(F1:F3))^0.5 =(D13/B6)* percent

(b)

123456789

10111213

A B C D E Fx1= 25 wx1= 2 188437.5 1.42035E+11x2= 50 wx2= 1 46875 2197265625x3= 75 wx3= 5 31250 24414062500

y= 2343750

2390859.375 (df/dx)1= 188437.52367187.5 (df/dx)2= 468752367187.5 (df/dx)3= 31250

wy= 410665.43 17.52172 percent

7326_C006.fm Page 139 Tuesday, March 7, 2006 6:19 AM

Page 155: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

140 What Every Engineer Should Know About Excel

wx1 = 2 (8%); wx2 = 1 (2%); wx3 = 5 (6.7%)

are shown in Figure 6.14b.

COMMENTBy observing the relative values of the entries at F1:F3, the experimentalist can usually

obtain an idea of the variables that cause the greatest uncertainty in the calculated result.In this example,

F1 = 1.4 × 1011

F2 = 2.2 × 109

F3 = 2.4 × 1010

Clearly, variable x1 causes the greatest contribution to the uncertainty of the result. Notonly does it have the greatest percentage uncertainty to start with, but it also influencesthe calculation of the result through a square term. From the standpoint of experimentplanning, the instrumentation or experimental technique associated with x1 should beimproved first to effect the greatest reduction in uncertainty of the results. In contrast,variable x2 contributes very little to the uncertainty of the result.

Example 6.9: Uncertainty in Measurement of Heat-Transfer CoefficientForced-convection heat-transfer coefficients may be measured by observing the tempera-ture rise of a fluid as it passes through the convection channel. The heat transfer may beexpressed by

q = mc(T2 − T1) (6.12)

whereq = heat-transfer rate, Wm = mass-flow rate of fluid, kg/secc = specific heat of the fluid, J/kg °CT1 = entering fluid temperatureT2 = exiting fluid temperature

This heat transfer may also be expressed in terms of the convection heat-transfer coef-ficient h with

q = hA(Tw − Tavg fluid) (6.13)

whereh = heat-transfer coefficient, W/m2 CA = surface area, m2

Tw = wall or surface temperature in contact with the fluid

The average fluid temperature may be taken as the mean between the entering andexiting fluid temperatures. Setting the two expressions for heat transfer equal, h may beexpressed as

7326_C006.fm Page 140 Tuesday, March 7, 2006 6:19 AM

Page 156: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 141

h = mc(T2 − T1)/A[Tw − (T2 + T1)/2] (6.14)

We now examine an experimental situation in which the uncertainties in the area, specificheat, and mass flow are assumed to be small in relation to the uncertainties in thetemperature measurements. Accordingly, we will set their uncertainties to zero in theanalysis of the overall uncertainty of the determination of h, the heat-transfer coefficient.

The worksheet is set up as shown in Figure 6.15, with A = 1, m = 1, c = 4180 (the valuefor water), T1 = 55°C, T2 = 65°C, and Tw = 85°C. The uncertainties in each of the temperaturedeterminations is assumed to be ± 1.0°C (<2%). In this example, we will see how thetemperature levels greatly influence the uncertainty in h even when the uncertainties inthe individual temperatures remain constant.

As in Example 6.8, we take the finite-difference change in each variable as 0.01 of thevariable for approximating the partial derivatives in cells B11:B13 and D11:D13. Four setsof results are shown as follows. For the given set of temperature data, the results areshown in Figure 6.16a, having an uncertainty in h of 15.1% of the calculated value of 1672W/m2 °C. In Figure 6.16b the value of T1 is reduced to 40°C, while keeping the other twotemperatures the same. The resulting uncertainty in h is now only 6.8%, or less than halfthe previous result. In Figure 6.16c the inlet and exit temperature are returned to theiroriginal values, but the wall temperature is lowered to 70°C. The uncertainty in h increasesto 18.8%. Finally, in Figure 6.16d the inlet temperature is raised to 60°C from 55°C, whileT2 and Tw remain at their original values. In this case, the uncertainty in h increases to thelarge value of 29.2%. Note that the uncertainty in each temperature has remained the samefor all four calculations, i.e., ±1°C.

The reason there is so much variation in the four results is that the uncertainties in theindividual temperatures produce larger or smaller uncertainties in the temperature dif-ference calculations of (T2 − T1) and (Tw − Tavg fluid) that appear in the formula for h,depending on the value of the temperatures themselves. If a fifth calculation were madewith T1 raised to 63°C while retaining T2 = 65°C and Tw = 85°C, the resulting uncertaintyin h would be a whopping 72%.

Uncertainties in A, c, and m could also be included in the calculation, but it should beobvious from the aforementioned results that they would have relatively less influenceon the final uncertainty in h.

FIGURE 6.15

123456789

1011121314151617

A B C DT1= 40 wT1= 1 =D11 =(E1*D1)^2T2= 65 wT2= 1 =D12 =(E2*D2)^2Tw= 85 wTw= 1 =D13 =(E3*D3)^2A= 1 wA= 0m= 1 wm= 0c= 4180 wc= 0

h= =$B$5*$B$6*($B$2-$B$1)/($B$4*($B$3-($B$1+$B$2)/2))

=$B$5*$B$6*($B$2-1.01*$B$1)/($B$4*($B$3-(1.01*$B$1+$B$2)/2)) dh/dT1= =(B11-B9)/(0.01*B1)=$B$5*$B$6*(1.01*$B$2-$B$1)/($B$4*($B$3-($B$1+1.01*$B$2)/2)) dh/dT2= =(B12-B9)/(0.01*B2)=$B$5*$B$6*($B$2-$B$1)/($B$4*(1.01*$B$3-($B$1+$B$2)/2)) dh/dTw= =(B13-B9)/(0.01*B3)

wh= =(SUM(F1:F3))^0.5 =(D15/B9)*100 percent

7326_C006.fm Page 141 Tuesday, March 7, 2006 6:19 AM

Page 157: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

142 What Every Engineer Should Know About Excel

6.7 Fractional Uncertainties for Product Functions of Primary Variables

Consider the case in which the result y is expressed as a product function of the primarymeasurement variables xi, each raised to a power ai. Thus,

(6.15)

FIGURE 6.16

(a)

123456789

101112131415

A B C D E FT1= 55 wT1= 1 -135.2 18291.95T2= 65 wT2= 1 203.28 41323.85Tw= 85 wTw= 1 -64.68 4183.612A= 1 wA= 0m= 1 wm= 0c= 4180 wc= 0

h= 1672

1597.613751 dh/dT1= -135.2481804.133739 dh/dT2= 203.28271617.021277 dh/dTw= -64.6809

wh= 252.5854 15.107 percent

(b)

123456789

101112131415

A B C D E FT1= 40 wT1= 1 -79.64 6342.212T2= 65 wT2= 1 179.88 32357.41Tw= 85 wTw= 1 -96.41 9295.531A= 1 wA= 0m= 1 wm= 0c= 4180 wc= 0

h= 3215.384615

3183.529412 dh/dT1= -79.6383332.307692 dh/dT2= 179.88173133.433283 dh/dTw= -96.4133

wh= 219.078 6.8134 percent

y x x x1a

2a

na1 2 n= ⋅ ⋅ ⋅

7326_C006.fm Page 142 Tuesday, March 7, 2006 6:19 AM

Page 158: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 143

Evaluating the partial derivatives in Equation 6.9 and dividing by y from Equation 6.15gives

wy/y = [∑(aiwxi/xi)2]1/2 (6.16)

When sums or differences of variables are involved in the result along with powervariables, some variable substitutions may be made to fit the result function into the formof Equation 6.15. For example, the relation

h = q/A(T1 − T2) (6.17)

could be rewritten with a variable substitution ΔT = T1 − T2 to read

FIGURE 6.16 (continued)

(c)

123456789

101112131415

A B C D E FT1= 55 wT1= 1 -214.9 46186.32T2= 65 wT2= 1 648.06 419984.4Tw= 70 wTw= 1 -390.7 152610.7A= 1 wA= 0m= 1 wm= 0c= 4180 wc= 0

h= 4180

4061.799486 dh/dT1= -214.914601.24031 dh/dT2= 648.062

3906.542056 dh/dTw= -390.654

wh= 786.6266 18.819 percent

(d)

123456789

101112131415

A B C D E FT1= 60 wT1= 1 -167.4 28011.84T2= 65 wT2= 1 209.45 43867.24Tw= 85 wTw= 1 -39.78 1582.537A= 1 wA= 0m= 1 wm= 0c= 4180 wc= 0

h= 928.8888889

828.4684685 dh/dT1= -167.3671065.028185 dh/dT2= 209.4451895.0749465 dh/dTw= -39.7811

wh= 271.038 29.179 percent

7326_C006.fm Page 143 Tuesday, March 7, 2006 6:19 AM

Page 159: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

144 What Every Engineer Should Know About Excel

h = q/AΔT (6.18)

The uncertainty in ΔT could be evaluated separately and then Equation 6.18 treated asa power relation with aq = 1, aA = −1, and aΔT = −1. The uncertainty in the result couldthen be evaluated using Equation 6.16.

For the product function cases, an Excel worksheet may be arranged to either calculatethe fractional uncertainty in the result directly from Equation 6.16 or to first compute theinfluence coefficients (aiwxi/xi)2 separately before carrying into the final result. Althoughthe latter calculation is a bit longer, it offers the opportunity to examine the relativemagnitudes of the influence coefficients and, thus, to obtain additional insight into thebehavior of the experimental results. Note that a calculation using Equation 6.16 does notinvolve any finite-difference approximations for the partial derivatives. Depending on thecomplexity of the experiment and the form of the result function, some combination ofmethods may be chosen for the calculation, as described in Example 6.10.

Example 6.10: Modification of Example 6.9 for Uncertainties in m and cExample 6.9 assumed exact determination of the mass flow m and specific heat c. Note thatboth variables appear as a product function in Equation 6.14. Now, let us examine the casein which m and c are not exact but have associated uncertainties of wm and wc. In addition,we assume that the mass-flow rate is determined from a flow measurement in which

m = CDAf(pΔp)1/2 (6.19)

where CD is a flow coefficient with a known uncertainty wCd, Af is an area known almostexactly, p is a pressure measure measurement, and Δp is a differential pressure measure-ment. Equation 6.19 is a product function, and wm/m can be calculated using Equation6.16, along with a determination of wc/c. A variable f(T) may be defined by

f(T) = (T2 – T1)/[Tw – (T2 + T1)/2] (6.20)

and a separate determination of wf(T)/f(T) made using the method of Example 6.9. Then,Equation 6.14 is expressed as a product result function

h = mc[f(T)]

with

am = 1, ac = -1, and af(T) = 1

A direct application of Equation 6.16 can be made to calculate the fractional uncertaintywh/h. Extension of this technique to more complex result functions is straightforward butmay be tedious in execution. A discussion of the importance of uncertainty determinationsin experiment design and various types of data analyses is given in Reference 3.

Example 6.11: Application of Product Method to Example 6.8The y function given in Equation 6.11 is obviously a product function with ax1 = 2, ax2 =1, and ax3 = 1. From Example 6.8, we have

x1 = 25; x2 = 50; x3 = 75; wx1 = 2; wx2 = 1; wx3 = 5

7326_C006.fm Page 144 Tuesday, March 7, 2006 6:19 AM

Page 160: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 145

The result for y is

y = (25)2(50)(75) = 2.344 × 106

Application of Equation 6.16 gives the fractional uncertainty for y as

wy/y = {[(2)(2)/25]2 + [(1)(1)/50]2 + [(1)(5)/75]2}1/2 = 0.17448

This value may be compared with the result given in Example 6.8 as 0.17522. The 0.17448value is the correct one because it does not rely on a finite-difference approximation to thepartial derivatives. Even so, the two results for fractional uncertainty agree within 1/2 %.Clearly, a worksheet could be constructed to examine the relative effects of the influencecoefficients on the result, similar to that in Example 6.8.

6.8 Multivariable Linear Regression

Linear regression analysis with a single independent variable may be performed with agraphical display and use of the trendline and R2 features discussed in Section 3.7 andSection 3.8.

Excel may also be used to perform a least-squares regression calculation for a linearfunction with multiple independent variables. Up to 16 variables may be accommodated.

Consider the variable y expressed as the linear function

y = m1x1 + m2x2 + … + mnxn + b (6.21)

which becomes the familiar linear equation for a straight line

y = mx + b (6.22)

when only a single independent variable is involved. Excel executes the least-squareslinear regression calculation through use of the worksheet function LINEST, whichrequires the following syntax:

LINEST(y-values, xn-values, constant(true/false), statistics(true/false)) (6.23)

where

n is the number of independent variables in Equation 6.21y-values is a known array of numerical y-values that may equal or exceed n + 1xn-values is a known array of numerical values for the independent variables that may

equal or exceed n + 1 for each variableconstant(true/false) is a logical statement; TRUE is entered if the regression analysis is

to include a determination of the constant b in Equation 6.21; FALSE is entered if the value of b is to be taken as zero

statistics(true/false) is a logical statement; TRUE returns a calculation of certain statisti-cal functions as described in the following text; entry of FALSE returns no statistical calculations

7326_C006.fm Page 145 Tuesday, March 7, 2006 6:19 AM

Page 161: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

146 What Every Engineer Should Know About Excel

The LINEST function must be entered as an array. A block of cells is first selected(activated), the function typed in the upper-left corner of the block, and the key combi-nation Ctrl+Shift+Enter pressed. The format of the results array is:

Thus, an array of 5 rows and n + 1 columns should be selected for the presentation ofthe results. No other information may appear in this block of cells.

The m and b values displayed are used in Equation 6.21, R2 is the coefficient of deter-mination described in Section 3.8, the se terms are the standard errors for the variousquantities, ssreg is the regression sum of squares, ssresidual is the residual sum of squares, dfis the number of degrees of freedom, and F is a statistical function. The reader shouldconsult Help/Index under the LINEST function and “standard errors” for a descriptionof the standard error and statistical functions. Our primary concern here is for the proce-dure to determine the mn and b constants.

Example 6.12: Linear Regression for Three VariablesNumerical values for y as a function of the three variables x1, x2, and x3 are shown inthe worksheet of Figure 6.17a, with eight numerical values for each variable. A block ofcells for the output results of the LINEST function is selected as A12:D16 in Figure 6.17b.The LINEST function is then typed in cell A12 as shown, in accordance with the syntaxof Equation 6.23. The array containing the numerical y-values is D2:D9, and the arraycontaining all of the numerical xn values is A2:C9. Entry of the first TRUE calls for adetermination of the constant b, whereas entry of the second TRUE calls for display ofthe statistical results. Ctrl+Shift+Enter is then pressed to execute the function.

The results are shown in Figure 6.17c along with the original numerical data. In accor-dance with the output format described in Section 6.8 we have:

m1 = 3.247873

m2 = 2.041483

m3 = 1.241881

b = −3.86409

R2 = 0.991044

and the final regression formula for y is

y = 3.247873x1 + 2.041483x2 + 1.241881x3 – 3.86409 (a)

Row1 mn mn-1 º m1 b2 sen sen-1 º se1 seb

3 R2 sey

4 F df5 ssreg ssresidual

7326_C006.fm Page 146 Tuesday, March 7, 2006 6:19 AM

Page 162: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 147

Note that the values of the mn appear in reverse order to the columns for the numericalvalues of the xn.

It is interesting to compare Equation (a) with the original numerical data. For the x-values in row 2 we may calculate:

y = (3.247873)(1) + (2.041483)(3.2) + (1.241881)(3) – 3.86409

= 9.642172 as compared to a data value of 9.5 in cell D2

For the x-values in row 9 we obtain:

y = (3.247873)(8) + (2.041483)(9) + (1.241881)(10) – 3.86409

= 52.911 as compared to a data value of 53 in cell D9

The value of R2 = 0.991 indicates a fairly good regression result.

Example 6.13: Modeling Performance of an Air-Conditioning UnitThe cooling performance of a commercial air-conditioning unit depends on the indoorand outdoor temperatures. The appropriate indoor temperature that governs the coolingprocess is the wet bulb temperature, which we designate as Tew (°F). The outdoor

FIGURE 6.17

7326_C006.fm Page 147 Tuesday, March 7, 2006 6:19 AM

Page 163: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

148 What Every Engineer Should Know About Excel

temperature that governs is the dry bulb temperature that enters the conditioning unit,which we designate as Tc(°F). The cooling performance of the unit is stated in units ofthousands of Btu/h and is designated as Qew.

The left portion of Figure 6.18a gives the performance data for an actual air-conditioningunit as specified by the manufacturer. These data are based on actual measurements ofthe unit’s cooling capacity and fitted to standard temperature ranges agreed to by man-ufacturers. Although these data are useful as they stand for unit-sizing activities, ananalytical expression of the data may be desired for modeling studies in conjunction withperformance of other devices associated with a particular application, such as pumps andfans. The LINEST worksheet function is a suitable way to obtain such a relation.

The dependent variable or “y-function” is Qew, whereas the independent variables areTew and Tc. A group of cells (A21:C25) is activated as shown in the right inset of Figure6.18a, and the LINEST function is entered in cell A21. The array for the y-variable isC4:C19, whereas the array containing the x-variables is A4:B19. TRUE is entered to obtaina fit with a constant value b, with TRUE also entered to obtain values of the statisticalparameters. Ctrl+Shift+Enter is pressed, and the regression parameters are listed in cellsA21:C21 with the values

mTew = 0.526

mTc = −0.228

FIGURE 6.18

(a)

12345678910111213141516171819202122232425

A B C D E F G H I

Tew Tc Qew72 85 54.372 95 51.872 105 49.472 115 46.667 85 50.467 95 4867 105 45.567 115 42.962 85 46.562 95 44.462 105 42.262 115 4057 85 45.757 95 43.957 105 4257 115 40

m(Tc) m(Tew) m(b)-0.228 0.526 34.723

0.023821451 0.047642902 3.8972650.942604839 1.065327685 #N/A106.7499661 13 #N/A

242.306 14.754 #N/A

7326_C006.fm Page 148 Tuesday, March 7, 2006 6:19 AM

Page 164: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 149

b = 34.723

The resulting linear regression formula to be used for calculating Qew is therefore

Qew= 0.526Tew – 0.228Tc + 34.723 (6.24)

with R2 = 0.943

Values calculated from this formula may be compared with the original data bycalculating a two-variable table using the DATA/TABLE command described in Section2.16. The worksheet for this calculation is shown in Figure 6.18b. An input cell of E1 ischosen for Tc, whereas cell E2 is chosen for Tew. The formula corresponding to Equation6.24 is entered in cell E5 as shown in the insert at the bottom of the figure. Values of Tc

are entered in row 5 to the right of the formula, whereas values of Tew are entered in

FIGURE 6.18 (continued)

Tc34.723 85 95 105 115

72 53.215 50.935 48.655 46.375Tew 67 50.585 48.305 46.025 43.745

62 47.955 45.675 43.395 41.11557 45.325 43.045 40.765 38.485

Comparison of Linear Regression andActual Capacity of A/C Unit

3537

3941

4345

47

4951

5355

85 95 105 115Tc, F

Qew

,kB

tu/h

r

Tew, F72

67

6257

Actual

Regression

(b)

(c)

7326_C006.fm Page 149 Tuesday, March 7, 2006 6:19 AM

Page 165: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

150 What Every Engineer Should Know About Excel

column E below the formula. The block E5:I9 is selected and DATA/TABLE clicked. E1is entered as the input row and E2 as the input column. OK is clicked and the calculatedtabular values for Qew appear as shown at the top of Figure 6.18b. These values may becompared with those in the original data of Figure 6.18a. Although they do not agreeexactly, the values are probably close enough for modeling purposes. A graphical com-parison of the original data and the regression calculations is given in Figure 6.18c. Thesolid lines represent the original data, whereas the dashed lines represent the regressionresults. We may note that the original data table almost certainly involves curve-fittingto the original experimental data.

6.9 Multivariable Exponential Regression

In addition to the linear regression analysis with the LINEST worksheet function describedin Section 6.8, Excel also provides an exponential regression operation, which employsthe LOGEST worksheet function. This function may be used to obtain a least-squaresregression to fit exponential functions of single or multiple independent variables,although single-variable regression is more easily accomplished as described in Section3.10 and Section 3.11. The general form of equation used for the fit is

(6.25)

For a single variable, the equation becomes

y = b × mx (6.26)

Execution of the least-squares regression is accomplished in the same manner as thatfor the linear analysis described in Section 6.8. Now, the LOGEST worksheet function isexecuted with the following syntax:

LOGEST(y-values,xn-values,constant(true/false),statistics(true/false)) (6.27)

where the nomenclature is the same as that for Equation 6.23. As with LINEST, the LOGESTfunction must be entered as an array by (1) selecting cells for the output array (sameformat as in Section 6.8), (2) entering the equation for the LOGEST function in the upper-left-cell of the array selected, and (3) pressing Ctrl+Shift+Enter. Use of the method isdescribed in the following example.

Example 6.14: Multivariable Exponential RegressionAs a matter of interest, we will perform a multivariable exponential regression on thesame data set used in Example 6.13 for a linear analysis. The data are displayed as beforein Figure 6.19a. A block of cells is selected for the output array as shown in the right-sideinsert of this figure, and the LOGEST function is entered in cell A21. Ctrl+Shift+Enter ispressed, producing the output shown in cells A21:C25 of the figure. We have the results:

mTc = 0.995039

y = b m m … m1x

2x

nx1 2 n× × ×

7326_C006.fm Page 150 Tuesday, March 7, 2006 6:19 AM

Page 166: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 151

mTew = 1.011377

b = 36.20986

which produce the final equation for Qew as

Qew = 36.20986 × 0.995039Tc × 1.011377Tew (6.28)

As in Example 6.13, the values of Qew may be calculated using the DATA/TABLEcommand as shown in Figure 6.19b. E1 is chosen as the input column cell for Tew, and cellE2 is the input row cell for Tc. Equation 6.28 is entered in cell E5, values of Tc are enteredto the right of the equation in row 5, values of Tew entered in row E below the equation,and the array E5:I9 selected (activated). DATA/TABLE is then clicked, and the resultsappear as shown at the top of Figure 6.19b. Finally, the original data and values calculatedfrom the LOGEST regression are compared in Figure 6.19c. For these data, the exponentialregression offers little advantage over the simpler linear format presented in Example 6.13.

FIGURE 6.19

(a)

123456789

1011121314151617181920212223242526

A B C D E F

Tew Tc Qew72 85 54.372 95 51.872 105 49.472 115 46.667 85 50.467 95 4867 105 45.567 115 42.962 85 46.562 95 44.462 105 42.262 115 4057 85 45.757 95 43.957 105 4257 115 40

0.995039 1.011377 36.209860.000486 0.000972 0.0794710.948703 0.021724 #N/A120.2139 13 #N/A0.113462 0.006135 #N/A

7326_C006.fm Page 151 Tuesday, March 7, 2006 6:19 AM

Page 167: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

152 What Every Engineer Should Know About Excel

FIGURE 6.19 (continued)

(b)

3456789

1011121314151617181920

D E F G H I

Tc36.20986 85 95 105 115

72 53.57681 50.97742 48.50415 46.15088Tew 67 50.63042 48.17398 45.83672 43.61286

62 47.84605 45.52471 43.31598 41.2144257 45.21482 43.02113 40.93387 38.94788

(c)

Comparison of ExponentialRegression and Actual Capacities of

A/C Unit

35

40

45

50

55

85 95 105 115Tc, F

Qew

,kB

tu/h

r

Tew, F

72

67

62

57

Actual

Regression

7326_C006.fm Page 152 Tuesday, March 7, 2006 6:19 AM

Page 168: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 153

Example 6.15: Combined Regression AnalysisAn inspection of the data in Figure 6.18a and the display in Figure 6.18c indicates a linearvariation of the cooling capacity Qew with the condenser temperature Tc. The variationwith Tew appears to be nonlinear. These facts suggest that a combination regression analysisusing a nonlinear variation with Tew may produce a better fit to the data points than thelinear regression developed in Example 6.13.

First, we reconstruct the data table of Figure 6.18a in the format shown in Figure 6.20a.Next, a chart is constructed for these data with Tew as abscissa, and is displayed in Figure6.20b. The curves with smaller line width are obtained for each value of Tc. For each ofthese lines, a second-degree polynomial (quadratic) is fitted using the method describedin Section 3.5. The resulting trendlines are plotted as heavy solid lines, and the trendlineequations are displayed alongside the graph. The average value of the coefficient of x2

(Tew2) is 0.034, and the average value of the coefficient of x (Tew) is –3.925. The apparent

linear variation of Qew with Tc suggests that a new variable Qew′ may be defined as

Qew′ = Qew – 0.034Tew2 + 3.925Tew = mTc + b (6.29)

where m and b are constants to be determined with a linear regression analysis of Qew′vs. Tc. The values of Qew′ are computed by using the DATA/TABLE command describedin Section 2.16, and the results are shown in Figure 6.20c.

FIGURE 6.20

Tc Tc85 95 105 115 85 95 105 115

57 45.7 43.9 42 40 57 158.959 157.159 155.259 153.259Tew 62 46.5 44.4 42.2 40 62 159.154 157.054 154.854 152.654

67 50.4 48 45.5 42.9 67 160.749 158.349 155.849 153.24972 54.3 51.8 49.4 46.6 72 160.644 158.144 155.744 152.944

y = 0.033x2-3.711x + 148.06

y = 0.037x2

-4.263x + 164.65

y = 0.037x 2 -4.319x + 165.87

y = 0.031x2

-3.405x + 138.91

35

40

45

50

55

55 60 65 70 75

Tew

Qew

(a) Data forQew

Tew

(c) Data forQew'

Tc, F

85

95

105

115

(b)

7326_C006.fm Page 153 Tuesday, March 7, 2006 6:19 AM

Page 169: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

154 What Every Engineer Should Know About Excel

The resulting values of Qew′ are then plotted as a function of Tc as shown in Figure 6.21a.A linear trendline is plotted through the data points, and the resulting trendline equationis displayed (with Tc substituted for x) as:

FIGURE 6.21

(a)

Tc Qew'85 158.95985 159.15485 160.74985 160.64495 157.15995 157.05495 158.34995 158.144

105 155.259105 154.854105 155.849105 155.744115 153.259115 152.354115 153.249115 152.944

y= -0.2302x + 179.51

R2 = 0.9524

151

152

153

154

155

156

157

158

159

160

161

162

85 95 105 115

Tc, F

Qew

'

(b)

Tc179.51 85 95 105 115

57 46.684 44.382 42.08 39.778Tew 62 47.289 44.987 42.685 40.383

67 49.594 47.292 44.99 42.68872 53.599 51.297 48.995 46.693

35

40

45

50

55

85 90 95 100 105 110 115

Tc, F

Qew

,kB

tu/h

r

7326_C006.fm Page 154 Tuesday, March 7, 2006 6:19 AM

Page 170: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 155

Qew′ = -0.2302Tc + 179.51 (6.30)

Equation 6.29 and Equation 6.30 are combined to give the final correlation for Qew as:

Qew = 0.034Tew2 – 3.925Tew – 0.2302Tc + 179.51 (6.31)

The DATA/TABLE command is used along with Equation 6.31 to construct a table ofresults for the combined regression analysis, and is shown in Figure 6.21b. Finally, compar-ison plots of the results and original data are given in Figure 6.22. The solid lines representthe data of Figure 6.20a, whereas the dashed lines are data obtained from Figure 6.21b. WhenFigure 6.22 is compared with the results of the linear regression shown in Figure 6.18c, it isseen that a somewhat better correlation is obtained with the combined method.

It should be noted that a certain amount of art is involved in effecting a combinedregression analysis. In most cases, the starting point is a construction of graphs of theresult y as functions of each independent variable. The appearance of the curves obtainedwill suggest the functional form of the correlation to be tried.

Example 6.16: Comparison of Results of Example 6.13, Example 6.14, and Example 6.15These examples presented three methods for obtaining a regression analysis or correlationfit for the data of Figure 6.18a. The results were presented as graphical displays in Figure6.18c, Figure 6.19c, and Figure 6.22, with comparison curves between the regressions andoriginal data as part of each of these figures. In this section, we will compare the regressionresults on the basis of a calculated root-mean-square deviation from the original data.Thus, we will perform the following calculation for each of the three regression results:

RMS Dev Qew(regression) = {[∑(Qew,regress – Qew,data)2]/n}1/2 (6.32)

where the summation is taken over the 16 original data points of Figure 6.18a and n = 16.The worksheet for the calculation is set up initially as shown in Figure 6.23a, with the

FIGURE 6.22

35

40

45

50

55

85 95 105 115

Tc, F

Qew

,kB

tu/h

r

ActualRegression

Tew, F

72

6762

57

7326_C006.fm Page 155 Tuesday, March 7, 2006 6:19 AM

Page 171: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

156 What Every Engineer Should Know About Excel

original data entered in columns B, C, and D and rows 5 through 20. The formula for thelinear regression of Qew was given in Equation 6.24 and is entered in the worksheet in cellE5. The result for the exponential regression given in Equation 6.28 is entered in cell F5,and the formula for the combined regression, Equation 6.31, is entered in cell G5. In theseformulas, B5 and C5 refer to the Tew and Tc data values, respectively.

The formulas in E5:G5 are drag-copied for another 15 rows to E20:EG20. The formulasare removed from view, and the calculated values for the three Qew,regress are displayed inE5:G20, as shown in Figure 6.23c. In addition, the squares of Qew,regress – Qew,data are com-puted and displayed in columns H, I, and J of this figure.

Finally, Equation 6.32 for the linear, exponential, and combined regressions is enteredin cells N5, N7, and N9, respectively, as shown in Figure 6.23b. In these formulas, theSUM worksheet function sums the squares of the deviations computed in columns H, I,

FIGURE 6.23

(a)

(b)

45678910

K L M N

RMS Dev Qew(Lin) = =((SUM(H5:H20))/16)^0.5

RMS Dev Qew(Expon) = =((SUM(I5:I20))/16)^0.5

RMS Dev Qew(Combine) = =((SUM(J5:J20))/16)^0.5

(c)

7326_C006.fm Page 156 Tuesday, March 7, 2006 6:19 AM

Page 172: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 157

and J. When the formulas are removed from view, the results are displayed in cells of N5,N7, and N9 of Figure 6.23c and repeated here as:

RMS Dev Qew(linear) = 0.9603 (6.33)

RMS Dev Qew(exponential) = 0.8633 (6.34)

RMS Dev Qew(combined) = 0.5578 (6.35)

These results agree with a visual comparison that one may make between Figure 6.18c,Figure 6.19c, and Figure 6.22. The combination regression procedure of Example 6.15provides the best fit to the original data. We note, as before, that the combination regressionis more complicated and requires more art and insight on the part of the person performingthe analysis.

Problems

6.1 Planck’s blackbody radiation formula is

Ebλ = C1λ−5/[exp(C2/λT) − 1]

where

C1 = 3.743 × 108 and C2 = 14387 and λ is in μm and T in K

Perform a numerical integration of this formula from 0 to 10 μm for temperaturesof 1000 and 2000 K, i.e., evaluate ∫Ebλdλ over the specified range. Repeat for 0 <λ < 20 μm.

6.2 A set of experimental data is expected to follow the relationship

y = Cxn

with the values of C and n given in the following table. Using appropriate IFstatements, devise a worksheet to calculate the values of y over the range of 4 <x < 400000. Then, plot y vs. x on a log–log scatter graph.

6.3 Another set of experimental data is expected to follow the same functional relationas given in Problem 6.2. The values of C and n for these data are given in the

x C n

4–40 0.911 0.38540–4000 0.683 0.4664000–40000 0.193 0.61840000–400000 0.0266 0.805

7326_C006.fm Page 157 Tuesday, March 7, 2006 6:19 AM

Page 173: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

158 What Every Engineer Should Know About Excel

following table. Devise a worksheet to calculate y as a function of x using IFstatements. Then plot the relation over the range 0.01 < x < 1012.

6.4 On a scale of 0 to 100, student test scores have the values:

87, 73, 90, 75, 96, 76, 84, 57, 58, 20, 76, 56, 82, 95, 94, 52, 82, 89, 56, 77, 20, 98, 68, 98, 38, 47, 93, 59, 69, 68, 49, 80

Following the procedure of Example 6.5, arrange the scores in 10-point bins froma score of 49.9 to 99.9, and construct an appropriate histogram of the scores.Determine the mean, median, maximum, and minimum scores as well as thesample and population standard deviations. Using histograms and variable binwidths, devise a system for setting letter grades of A through F for these scores.Consider at least three alternatives.

6.5 Compare a cumulative frequency distribution of the student scores in Problem6.4 with that of a normal distribution having the same mean and standard devi-ation. What do you conclude?

6.6 A certain experimental result y is a function of three measured variables throughthe relation:

y = x1x2/x3

The measured variables have uncertainties of wx1 = ± 1.0, wx2 = ± 0.5, and wx3 =± 0.2, and the variables are measured over the following ranges:

5 < x1 < 100

5 < x2 < 100

15 < x3 < 100

Devise a worksheet to calculate the values of y and their percentage uncertainties.Then perform these calculations at the upper and lower limits of the measurementranges and two intermediate points.

6.7 An experimental result y has the functional form of

y = x1 + (x2x3)1/2

in terms of the three measured variables. The uncertainties in all three variablesare ± 1.0, and the variables are measured over ranges of 10 to 100. Devise a

x C n

0.01–100 1.02 0.148100–10000 0.85 0.18810000–1.0E7 0.48 0.251.0E7–1.0E12 0.125 0.3333

7326_C006.fm Page 158 Tuesday, March 7, 2006 6:19 AM

Page 174: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Other Operations 159

worksheet to calculate values of y and their percentage uncertainty. Perform thecalculations for the lower and upper limits of the measured variables and twointermediate points.

6.8 For the student test scores in Problem 6.4, plot the normal probability densityfunction for one and two standard deviations.

6.9 The manufacturer’s performance data for an air-conditioning unit similar to thatdiscussed in Example 6.13 is given in the following table. Note that the electricwork input W, expressed in kW, is furnished in addition to the cooling perfor-mance Qew in kBtu/h. Following the methods of Example 6.13 and Example 6.14,obtain linear and exponential regressions for both Qew and W. Plot the results ofthe analysis compared with the data table. Compare the results of the regressionanalyses using RMS Dev defined in Equation 6.32.

Performance of an Air-Conditioning Unit

Tew (°F) Tc (°F) Qew(kBtu/h) W(kW)

72 85 66.2 4.98

72 95 63.3 5.47

72 105 60.2 6.06

72 115 57 6.69

67 85 61 4.87

67 95 58.4 5.4

67 105 55.5 5.98

67 115 52.5 6.6

62 85 56.2 4.8

62 95 53.8 5.33

62 105 51.2 5.9

62 115 48.5 6.52

57 85 54.2 4.78

57 95 52.2 5.31

57 105 50.1 5.89

57 115 47.9 6.51

7326_C006.fm Page 159 Tuesday, March 7, 2006 6:19 AM

Page 175: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C006.fm Page 160 Tuesday, March 7, 2006 6:19 AM

Page 176: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

161

7

Financial Functions and Calculations

7.1 Introduction

In engineering design applications, different economic alternatives must frequently beinvestigations. Excel offers over 50 built-in financial functions that may be employed forsuch investigations. We shall now give examples of calculations based on some of thesefunctions. First, we define the nomenclature employed in the syntax statements of theExcel functions and see how they relate to some elementary compound interest formulas.

7.2 Nomenclature

fv

This is the future value an investment may have after all payments have beenmade or accrued, including an initial payment.

nper

This is the number of periods that investment payments are made. The periodsmay be uniform or nonuniform in time and may be specified in terms of days,months, years, or the time between specific dates. This term is usually designatedby the symbol n.

pmt

This is the periodic payment to or from an investment medium. The paymentmay be constant or variable with time.

pv

This is the present value of a set of future payments or the current value of a loan.

Rate

This is the interest rate or discount rate of a loan or investment specified for aparticular period, such as annually or monthly. It is usually designated by thesymbol I. When entering as an argument in the Excel functions, it must be ex-pressed as a percentage or a decimal fraction. Twelve percent would be enteredas 12% or 0.12, but not as 12. If 12% is stated as the annual rate, the monthly ratewould be 12%/12 = 1% unless monthly compounding is specified.

Type

This is the type of interval for which investments are made, i.e., whether at thebeginning or end of the period. Set as 0 (or omit) for payments at the end of theperiod and 1 for payments at the beginning of the period.

7326_C007.fm Page 161 Tuesday, March 7, 2006 6:20 AM

Page 177: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

162

What Every Engineer Should Know About Excel

Dates

This is the entry of a specific date such as 4/15/91 for April 15, 1991. See Help/Index under Dates for a full discussion of the Excel system for setting dates.

7.3 Compound Interest Formulas

The Excel financial functions are related to elementary compound interest formulas thatwe shall state here:

1. Amount to which $1 will accumulate at an interest I per period for n periods:

fv = (1 + I)

n

(7.1)

2. Payment per period at interest rate I for n periods to repay a loan having a presentvalue of $1:

pmt = I/[1

(1 + I)

n

] (7.2)

3. Present value of $1 per period for n periods at interest rate I per period:

pv = [1

(1 + I)

n

]/I (7.3)

4. Amount to which $1 per period will accumulate when invested for n periods atinterest rate I per period:

fv = [(1 + I)

n

1]/I (7.4)

All of these equations may be evaluated easily with a calculator for one-shot computa-tions, but the appropriate Excel function will be preferable for use in larger programs. Inmost cases, the Excel functions allow for more variables and flexibility than the simpleformulas.

Table 7.1 gives a summary of the functions we will discuss, the syntax (along withvariables) required for evaluation of each function, and a description of the computationperformed by the function. At least one specific example will be given for each function,and where needed a copy of the appropriate worksheet displays will be provided.

Example 7.1: Accumulation of Uniform Monthly Payments

To what future value will a uniform series of monthly payments of $100 accumulate overa 5-year period with an annual interest rate of 12%?

The calculation can be made with either Equation 7.4 or the FV function.The number of monthly periods is 5

×

12 = 60 and the monthly interest rate is 12%/12= 1%. Using Equation 7.4 and multiplying by the $100 monthly payment gives:

FV = 100

×

[(l + 0.01)

60

1]/0.01 = $8166.97 (7.5)

The FV function yields:

FV(0.01,60,100,0,0) = $8166.97 (7.6)

7326_C007.fm Page 162 Tuesday, March 7, 2006 6:20 AM

Page 178: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

163

TABLE 7.1

Financial Functions and Operational Syntax

Financial FunctionsName of Function Syntax Calculation Performed by Function

Present value PV(rate,nper,pmt,fv,type) Determines the present value of a set of uniform payments paid out over the number of periods, with a cash value of fv at the end of the last payment

Future value FV(rate,nper,pmt,pv,type) Determines the future value of a set of uniform payments paid out of the investment medium (payments into the investment are negative values). The payments start with a lumpsum payment of pv

Number of periods NPER(rate,pmt,pv,fv,type) Calculates the number of uniform payments, pmt, to achieve the other values in the syntax statement

Rate RATE(nper,pmt,pv,fv,type,guess)

Requires an iterative calculation with an initial guess for the final rate. If the guess is omitted, a rate of 10% (0.1) is assumed. The function determines the interest rate necessary to yield the other values specified in the syntax statement

Payment PMT(rate,nper,pv,fv,type) Determines the constant periodic payment required to achieve the other values in the syntax statement

Net present value NPV(rate, value1 value2, … to 29 arguments)

Determines the sum of present values for up to 29 arguments at equally spaced time increments. The interest rate is assumed constant for each period. Payments received are entered as positive values, whereas payments made are entered as negative values. The values are entered at the end of each period. An initial investment at the start of the first period is added to the present value calculated by this function. This function may be thought of as the inverse of the IRR function, i.e., NPV(IRR(…), …) = 0

Internal rate of return IRR(values,guess) Requires an iterative calculation and an initial guess for the rate. If no guess is entered, a value of 0.1(10%) is assumed. If #NUM! Error values appear, or an unacceptable result is obtained, repeat using a different guess. This function determines the rate of return per period necessary to return the set of cell values listed in the syntax. Payments received are entered as positive values, whereas payments to the investment are counted as negative values. The payments need not be uniform, but the period must be constant in time length. For the calculation, at least one positive and one negative value are required. This function may be thought of as the inverse of the NPV function, i.e., NPV(IRR(…), …= 0

7326_C007.fm Page 163 Tuesday, March 7, 2006 6:20 AM

Page 179: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

164

What Every Engineer Should Know About Excel

where the present value is assumed to be zero.

Example 7.2: Accumulation of Uniform Payments with Present Cash Value

Repeat Example 7.1 for a present cash value of $5000 that accumulates along with themonthly cash payments.

The FV function in this case becomes

FV(0.01,60,100,5000,0) = $17,250.45 (7.7)

Equation 7.1 may be used to calculate the future value for the $5000 as

FV = 5000

×

(1+0.01)

60

= $9083.48 (7.8)

When this value is added to that of Equation 7.5 of Example 7.1, we obtain 9083.48 +8166.97 = $17,250.45, a value in agreement with the calculation using the FV function.

TABLE 7.1

(continued)

Financial Functions and Operational Syntax

Financial FunctionsName of Function Syntax Calculation Performed by Function

Net present value of as series of payments that may be nonuniform.

XNPV(rate,values,dates) Determines the present values for a series of future cash flows that may be nonperiodic. Thus, it is necessary to specify the date when each cash payment is received. The first date must correspond to the first cash payment. All other data must have dates later than this entry. The number of values must equal the number of dates; otherwise a #NUM! Error will be returned

Modified internal rate of return

MIRR(values,finance rate,reinvestment rate)

The values arguments represent a series of periodic payments (negative values) or income (positive values). The finance rate is the “cost” of payments into the fund, whereas reinvestment rate represent the rate at which payments out of the fund can be reinvested. The values must contain at least one positive and one negative value. The values may be nonuniform, but the period must be uniform

Internal rate of return for nonperiodic payments

XIRR(values,dates,guess) Similar to IRR except that the period may be nonuniform. The IRR function should be used for periodic payments. At least one positive cash flow (payment out) and one negative cash flow (payment in) are necessary for the iterative calculation. If no guess is made for the interest rate, a value of 0.1 will be assumed. Each date entry must correspond to its respective value entry. The earliest date must be the first entry, but later dates can be in any order. The XIRR function is related to the XNPV function. The rate calculated by XIRR corresponds to an interest rate that will cause XNPV = 0

7326_C007.fm Page 164 Tuesday, March 7, 2006 6:20 AM

Page 180: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

165

Example 7.3: Time Period for Defined Accumulation

A person wishes to accumulate a sum of $100,000 starting with an initial investment of$5000 and then making monthly payments of $1000. He assumes an interest rate of 12%per year. How many months will be needed to accumulate $100,000?

In this case we apply the NPER function with the following arguments:Rate = 12%/12 = 1%, pmt = $1000 per month, pv = $5000, fv = $100,000, and type = 0,

or payment at the end of the periods. Thus,

NPER(1%,

1000,

5000,100000,0) = 64.76 months (7.9)

Note that we could also have taken rate = 0.01.

Example 7.4: Rate of Return for Discount Bonds

An investor buys a $100,000 bond with a coupon rate of 5% paid semiannually. Thebond is purchased at a 20% discount ($80,000 for a $100,000 bond), and the bond maturesin 5 years. What is the internal rate of return for this investment?

This example is obviously an application of the IRR function. We first list all the pay-ments paid out of the investment in column B of the worksheet in Figure 7.1. There are10 semiannual payments out (positive values) of $2500 ((5%/2)

×

100,000) plus the $100,000paid at maturity. In addition there is a negative payment at the start of

80,000, whichrepresents the purchase price of the bond. The last payment is therefore 100,000 + 2500 =102,500. The IRR function is entered in cell B16 as

=IRR(B3:B13) = 4.86563%

FIGURE 7.1

123456789

101112131415161718192021

A B C D EPeriod PaymentsOut PaymentsOut Date

of Investment of Investment-80000 -80000 32874

1 2500 -68000 329642 2500 2500 330553 2500 2500 332394 2500 2500 334205 2500 2500 336046 2500 2500 337867 250 2500 339708 2500 2500 341519 2500 2500 3433510 102500 2500 34516

102500 34700100000 34790

IRR= =IRR(B3:B13)XIRR= =XIRR(D3:D15,E3:E15,4%)

NPV= =NPV(4.86563%,B4:B13)

MIRR= =MIRR(B3:B13,0.025,0.05) XNPV= =XNPV(9.3005%,D3:D15,E3:E15)

7326_C007.fm Page 165 Tuesday, March 7, 2006 6:20 AM

Page 181: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

166

What Every Engineer Should Know About Excel

This is the semiannual rate; thus, the annual rate would be 4.86563

×

2 = 9.73126%. Notethat no guess was entered for the rate, so the function assumed a value of 10%. If thecalculation were made with a guess of 2%, the same answer would result.

The answer may be checked by calculating the NPV function using a rate of 4.86563%and the same payments used in the IRR calculation. This computation is also listed onthe worksheet at cell B17, and gives the result

NPV(4.86563%,B3:B13) = $80,000.01

which, of course, is the purchase price of the bond at the start of the first period.

Example 7.5: Rate of Return with Reinvestment of Bond Interest

Assume that the funds received by the bond investor in Example 7.4 may be reinvestedat a rate of 10% per year. The interest rate for financing the original investment of $80,000is 5% per year. Calculate the modified rate of return for this financing arrangement.

The calculation is performed by calling up the MIRR function in cell B20 of Figure 7.1.For the semiannual period, the financing rate is entered as 0.025 (5%/2), whereas thereinvestment rate is entered as 0.05 (10%/2). We have the result:

MIRR(B3:B13,0.025,0.05) = 4.8808%

or an annual rate of 2

×

4.8808 = 9.7616%.

Example 7.6: Rate of Return of Zero-Coupon Bond

The investor in Example 7.4 decides to buy another 5-year bond, 3 months after the firstbond purchase. The new bond is a “zero-coupon” instrument, which sells at a deepdiscount but does not return any funds to the investor until maturity. The purchase pricefor this bond is $68,000 for a value at maturity of $100,000 five years later. Calculate theinternal annual rate of return for this bond.

For this calculation, we can use the compound interest formula of Equation 7.1 andsolve for I, the interest rate. We have:

pv = 68,000

fv = 100,000

N = 5

Using logarithms in Equation 7.1 results in an equation for the interest rate as

I = exp[ln(fv/pv)/n]

1

I = exp[ln(100000/68000)/5]

1 = 0.080185 = 8.0185%

The 8.018% is an annual rate because n = 5 is the number of annual periods.

7326_C007.fm Page 166 Tuesday, March 7, 2006 6:20 AM

Page 182: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

167

Example 7.7: Rate of Return of Multiple Bond Investments

The bond purchases in Example 7.4 and Example 7.6 may be considered as one investmentwith variable payouts over the period of 5 years and 3 months. (The second bond ispurchased 3 months after the first bond.) Calculate the internal rate of return for thisoverall investment.

This problem involves nonequal payments at nonuniform periods. We list the paymentsin column D of Figure 7.2, with their corresponding dates listed in column E. Based on a365-d year, the computer converts the date for each payment to a number of days beginningwith a zero day starting on January 1, 1900. The first bond purchase is listed as

80000 incell D3, and the second bond purchase is listed as

68000 in cell D4. The coupon paymentsfor the first are listed in cells D4:D13. The maturity payment for the first bond is the entryin cell D14, whereas the maturity payment for the second bond is listed as 100000 in cellD15. The XIRR function is employed for the calculation and is entered in cell E17 as

=XIRR(D3:D15,E3:E15,4%) with a result of 9.3005% on an annual basis

The 4% entry is the guess to start the iterative calculation. The result may be checkedwith the XNPV function entered in cell E20 as

=XNPV (9.3005%,D3:D15,E3:E15) = 0.15158

0 (compared to 80000)

In other words, the present value of all the payments is zero until the initial investmentsare made.

FIGURE 7.2

123456789

101112131415161718192021

A B C D EPeriod Payments Out Payments Out Date

of Investment of Investment-80000 -80000 1/1/90

1 2500 -68000 4/1/902 2500 2500 7/1/903 2500 2500 1/1/914 2500 2500 7/1/915 2500 2500 1/1/926 2500 2500 7/1/927 250 2500 1/1/938 2500 2500 7/1/939 2500 2500 1/1/94

10 102500 2500 7/1/94102500 1/1/95100000 4/1/95

IRR = 4.86563%XIRR= 9.3005%

NPV = $80,000.01

MIRR= 4.880826% XNPV= 0.151576963

7326_C007.fm Page 167 Tuesday, March 7, 2006 6:20 AM

Page 183: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

168

What Every Engineer Should Know About Excel

7.4 Investment Accumulation with Increasing Annual Payments

The first case we will consider is the accumulation problem. The nomenclature that weshall employ is as follows:

A

Present accumulation at beginning of period

N

Number of periods payments are to be made into investment

S

Amount to be invested at beginning of initial period

R

Rate of increase in S in subsequent years (R = 0.05 for 5%) (this rate may be eitherpositive or negative)

I

Assumed rate of return (interest) on investment (I = 0.05 for 5%) for the period

A(n)

Accumulation of investment after n periods

By writing out the sequence of payments for n periods, it is possible to express therelation for A(n) in a compact formula as:

A(n) = A

×

(1 + I)

n

+ S

×

(1 + I)

×

[(1 + I)

n

(1 + R)

n

]/(I

R) (7.10)

7.5 Payout at Variable Rates from an Initial Investment

The second case is just the reverse of the accumulation problem. In this instance, we startout with an investment sum and then make payout that increases in each period for aspecified number of periods. The nomenclature employed this time is:

B

Accumulation at start of payout

n

Number of periods payout is to be made

P

Amount of first payment at end of first period

C

Rate of increase in P each period (C = 0.05 for 5%)

I

Assumed rate of return (interest) on investment for each period (I = 0.05 for 5%)

B(n)

Capital (funds) remaining at end of n years

The relation for B(n) is:

B(n) = B

×

(1+I)

n

P

×

[(1+I)

n

(1+C)

n

]/(I

C) (7.11)

7326_C007.fm Page 168 Tuesday, March 7, 2006 6:20 AM

Page 184: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

169

There are two limiting cases of Equation 7.11 that express the fraction P/B for (1) noreduction in capital, i.e., B(n) = B and (2) complete consumption of capital, i.e., B(n) = 0.For these cases, we have:

P/B = (I – C)

×

[1 – (1+I)

-n

]/{1 – [(1+C)/(1+I)]

n

} (7.11a)

for B(n) = B

and

P/B = (I – C)/{1 – [(1 + C)/(1 + I)]

n

} (7.11b)

for B(n) = 0

A more general relation for retention of a fraction F of the capital uses F

= B(n)/B and

P/B = (I – C)

×

[1 – F

×

(1 + I)

-n

]/{1 – [(1 + C)/(1 + I)]

n

} (7.11c)

Example 7.8: Accumulation of Retirement Contributions with Increasing Rate

The purpose of this example is to show the effect of increasing contributions to an invest-ment each year at some assumed rate of increase. The results can be rather dramatic.Suppose that a person has accumulated $20,000 in savings toward retirement at age 35and is now starting a contribution plan in which he will be able to contribute $6000 thefirst year. Because of anticipated salary increases, he estimates that he will be able toincrease his contributions by 5% each year (R = 0.05). He estimates that he will be able toachieve an average return on investment of 8% over the years (I = 0.08). He wishes toestimate the accumulation that will be achieved at age 65 (n = 30 years) using Equation7.10. We have already noted the values of R and I earlier. Observe that the presentaccumulation A is $20,000, whereas the initial annual contribution is S = $6000. Insertingall these values in Equation 7.10 gives for the accumulation A(n) after 30 years:

A(n) = $1,441,247

which is a rather substantial amount. This sum might be entered into Equation 7.11 withappropriate assumptions to estimate retirement benefits over an extended period of time.

Example 7.9: Payout of Retirement Benefit That Increases with Cost of Living

In this example, we start with an assumed accumulation and examine the effects ofdrawing down the sum with increasing payouts to match an anticipated rise in the costof living. For this case, we assume that an investment is available that will yield a tax-free return of 7% (I = 0.07) after taxes and that the cost of living will increase 4% per year(C = 0.04). The prospective retiree has accumulated a sum of $500,000 and has determinedthat he needs about $25,000 per year for a comfortable retirement. We use Equation 7.11for the calculation, taking I and C as given along with B = $500,000 and P = $25,000. Theprospective retiree wishes to know what will remain of his original investment after 20years (n = 20). We insert the aforementioned values in Equation 7.11 and obtain:

7326_C007.fm Page 169 Tuesday, March 7, 2006 6:20 AM

Page 185: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

170

What Every Engineer Should Know About Excel

B(n) = $536,041

i.e., his investment has actually grown over this period of time by the amount of $36,041.Please note that this calculation assumes that the $500,000 initial investment has beenaccumulated after taxes.

Example 7.10: Payout to Exhaust Retirement Fund

The individual in Example 7.9 wishes to determine the maximum initial payment for thegiven conditions that will just exhaust the fund after 20 years. Equation 7.11b applies,with I = 0.07, C = 0.04, and n = 20, to give:

P/B = 0.069161

With B = $500,000, this gives a first-year payment of 0.069161

×

500,000 or

P = $34,580

A worksheet is shown in Figure 7.3 listing the input parameters and formulas necessaryfor the solution of the previous examples. The results are shown in the boxes at the rightof the sheet. To use the program, the formula display should be removed by clickingTOOLS/OPTIONS/VIEW/remove the check from Formulas. Values of the parameters are

FIGURE 7.3

12345678910111213141516171819202122232425262728293031

A B E

ACCUMULATION OF FUNDS

A= 20000 Accumulation at present A= 20000n= 30 number of year = 30S= 6000 Amt invested at start of perio = 6000I= 0.08 rate of return I= 0.08R= 0.05 rate of increase of S R= 0.05

A(n)= =B4*(1+B7)̂ B5+B6*(1+B7)*((1+B7)̂ B5-(1+B8)̂ B5)/(B7-B8) Accumulation after n year (n)= 1441247

PAYOUT OF FUNDSB= 500000 Accumulation at presentn= 20 number of year = 500000P= 25000 amt of first paymen = 20I= 0.07 rate of return P= 25000C= 0.04 rate of increase of P I= 0.07B(n) = =B13*(1+B16)̂ B14-B15*((1+B16)̂ B14-(1+B17)̂ B14)/(B16-B17) funds remaining after n year = 0.04

B(n) = 536041For F= 0 fraction of funds remainingP/B= =(B16-B17)*(1-B20*(1+B16)̂ -B14)/(1-((1+B17)/(1+B16))̂ B14)

B= 500000n= 20P= 34580I= 0.07C= 0.04B(n) =

For F= 0P/B= 0.06916

ACCUMULATION AND PAYOUT OF INVESTMENTS

Cell B10 is value of A(n) calculated from Eq. (7.5.1)Cell B18 is value of B(n) calculated from Eq.(7.5.2)Cell B21 is value of P/B calculated from Eq. (7.5.2c)Click TOOLS/OPTIONS/VIEW/remove check on Formulas toremove formulas from view. Enter parameters for calculation.

7326_C007.fm Page 170 Tuesday, March 7, 2006 6:20 AM

Page 186: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

171

entered at B4:B8, B13:B17, and B20. The results are displayed at B10, B18, or B21.

Do notenter numerical values in B10, B18, or B21 as the formulas will be erased.

Problems

7.1 Three $1000 monthly payments are made into an account with an initial balanceof $10,000. Three withdrawals of $1500 per month and six deposits of $1200 permonth follow these payments. Calculate the present and future values of thesepayments for an interest rate of 12% per year.

7.2 An investor plans to make 12 annual deposits of $10,000 into an investment witha present value of $50,000. What rate of interest is required for the investment toaccumulate to $300,000 in 12 years?

7.3 Using the results of Problem 7.2, apply the PMT function to verify the $10,000annual payment.

7.4 A bond that matures in 5 years has a present market value of $9000 and a maturityvalue of $10,000. Semiannual coupon payments are made at an annual rate of 6%of the maturity value. Assuming the cash payments may be reinvested at a rateof 6%, calculate the present value of the investment and the value at maturity.

7.5 An investment group has a fund with a present cash value of $65,000. Monthlypayments are to be added to the fund in the amount of $5000 per month. Theanticipated rate of return on the investments is 9% per year. How long will it taketo accumulate $300,000?

7.6 An investment group provides a cash outlay of $500,000 by borrowing the sumat an interest rate of 6.5% per year with monthly payback. The funds are investedin a real-estate venture with an anticipated return of 12% per year in semiannualpayments. Calculate the accumulated value at the end of 8 years and the presentvalue of the investment returns. State the assumptions.

7.7 A housing project requires an initial cash outlay of $400,000 followed by monthlypayments of $25,000 for 24 months. The project will provide quarterly incomepayments (8 payments) of $150,000 each. What is the internal rate of return of thisinvestment?

7.8 Financial advisors sometimes recommend “laddering” of fixed income invest-ments. The following three investments are suggested:

• $90,000 in a bond maturing to $100,000 in 5 years with an annual payout of6% of the maturity value.

• $30,000 one year later in another 5-year bond yielding 5.75% and selling for85% of maturity value.

7326_C007.fm Page 171 Tuesday, March 7, 2006 6:20 AM

Page 187: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

172

What Every Engineer Should Know About Excel

• $40,000 a year later in a 5-year bond yielding 6.25% and selling for 92% ofmaturity value.

a. Calculate a net present value of all the payments assuming a rate of 5%.b. Calculate the internal rate of return of the investments over the 8-year period.

7.9 If the financing cost of the bond investments in Problem 7.8 is 5.5% and thereinvestment rate is 6.35%, calculate the modified rate of return.

7.10 A construction project is to be financed with a cash payment of $100,000 and abank loan of $1,000,000 at 9%, paid back in 24 equal monthly installments. Incomefrom the project is assumed to start at month 25 at the rate of $50,000 per monthfor 12 months followed by income of $75,000 per month for 24 months. Calculatethe internal rate of return of all the payments over the 5-year period.

7.11 Assuming the payments from the project in Problem 7.10 are invested at a rate of6.5%, what will be the accumulation at the end of the 5-year period? What presentvalue, invested at 6.5%, would produce the same accumulation?

7.12 Compare the following investments on an appropriate basis. State the assump-tions.

a. A tax-free zero-coupon bond yielding 5% to maturity in 10 years.b. A tax-free coupon bond yielding 5% paid semiannually over a 10-year period.c. The same present value as (a) invested in a tax-sheltered account that accu-

mulates at 7% for 10 years. The gain over the initial investment is taxable ata rate of 28% at the end of the 10-year period.

d. The same present value as (a) invested in a taxable bond yielding 7%. Theincome is taxed at a rate of 28%.

e. The same present value as (a) invested in a real-estate venture, which accu-mulates at the rate of 8%, with the profit (gain) taxed at a rate of 20% at theend of 10 years.

7.13 A sum of $500,000 is available for payout with an investment return of 6% withthe payout increased 3% each year over a period of 15 years. What initial paymentis allowed if the fund is to be exhausted after 15 years?

7.14 A trust fund is to be created, which will accumulate to $500,000 over a 15-yearperiod assuming a return on investment of 6%. Annual payments will be madeinto the fund, which increase at the rate of 3% per year. What initial payment isrequired? For a 6% interest rate, what is the present value of all the payments?

7.15 A dedicated fund of $500,000 is provided for maintenance of a facility over a 20-year period. The facility will be torn down at the end of 20 years. It is estimatedthat the maintenance costs will increase at the rate of 2.9% per year and the fundswill earn a rate of return of 6.2%. Based on these assumptions, what initial annualpayment should be made to exhaust the fund? What will be the last payment?

7326_C007.fm Page 172 Tuesday, March 7, 2006 6:20 AM

Page 188: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Financial Functions and Calculations

173

7.16 A project is to be financed over a 20-year period. The assumption is made thatincome will rise each year such that the net cash input required will decrease by4% per year. A return on investment of 7% is assumed. The initial annual paymentis $50,000 from an investment fund of $500,000. What will be the value of the fundafter 20 years?

7.17 Suppose the investors for the project in Problem 7.16 desire to retain all of theinitial capital of $500,000 after 20 years. What first-year payment would be per-mitted? Repeat for retention of 50% of the original capital.

7.18 A trust fund has an initial cash value of $100,000 available for investment. Addi-tional annual payments into the fund will be made starting with $21,000. Theannual payments will increase by 5% per year and the return on investment isassumed to be 8% per year. Compare two alternatives:

a. The investments are made into a tax shelter in which the total interest gain istaxed at 28% after 10 years.

b. The interest gain is taxed annually at a rate of 28% that reduces the effectiveafter-tax return on investment to (1

0.28)

×

8% = 5.76%.

7326_C007.fm Page 173 Tuesday, March 7, 2006 6:20 AM

Page 189: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C007.fm Page 174 Tuesday, March 7, 2006 6:20 AM

Page 190: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

175

8

Optimization Problems

8.1 Introduction

We have seen how Solver and Goal Seek may be employed to solve single nonlinearequations or simultaneous linear or nonlinear equations through an iteration process. Thatprocess iterates on the values of the variables to cause a target function to approach zero.Now, we will see how Solver can be used to maximize or minimize a function subject toa set of constraints that take the form of inequalities. The function that is set as the targetis usually called the

objective function

. Other titles may be adopted depending on thesituation they represent, such as cost function (minimize costs), weight function (minimizeweight), profit function (maximize profits), etc. The optimization process is normallytreated as a subject in operations research, and the mathematical techniques are part ofthe subject of mathematical programming.

We will not discuss specific applications of the optimization processes, but we directthe reader to Reference 2, Reference 7, and Reference 8 for further information.

The objective function is defined as

y =

g

(x

1

, x

2

, …, x

n

) (8.1)

which is expressed as a function of the variables x

i

. The constraints on the

g

function arealso expressed in terms of the x

i

variables through additional functional relations

ƒ

i

(x

1

, x

2

, …, x

n

) = 0,

0, or

0 (8.2)

The number of

ƒ

i

functions may be small or large, and are generally not equal to thenumber of x

i

variables. Note that both equalities and inequalities may be part of theconstraints. For simple problems the number of variables may number only two or three;for complicated problems they may be hundreds or thousands. For only two variables,i.e., x

1

and x

2

, the optimization process may be depicted graphically, but for larger numbersof variables such a representation is not possible (unless a person has extraordinaryvisualization capabilities!).

If both the g and

ƒ

functions are linear in x

I

, we say that the problem is linear, and thesolution is obtained by linear programming. If one or more of the g or

ƒ

functions isnonlinear, the problem is nonlinear and becomes more complicated. We shall considertwo optimization problems, each with two variables. One linear and one nonlinear prob-lem will be examined. As mentioned earlier, such problems may be represented graphi-cally. We will solve these problems graphically to illustrate the concepts. Then, we willemploy Solver to obtain the same solutions, independent of any graphical display.

7326_C008.fm Page 175 Tuesday, March 7, 2006 6:20 AM

Page 191: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

176

What Every Engineer Should Know About Excel

8.2 Graphical Examples of Linear and Nonlinear Optimization Problems

We first consider the linear problem:Maximize or minimize

y = g = 2x

2

+ 3x

1

(8.3)

subject to the constraints

ƒ

1

= x

1

+ x

2

5

ƒ

2

= 2x

1

+ x

2

12 (8.4)

ƒ

3

= x

1

0

ƒ

4

= x

2

0

In most practical problems the variables x

i

are positive because they represent cost peritem, number of bolts or nuts produced, quantity of an ingredient in a food process, etc.

The graphical display for this problem is shown in Figure 8.1. First, the line x

1

+ x

2

=5 is plotted as shown. The acceptable values of y must lie above this line because of the

5 specification. Next, the line 2x

1

+ x

2

= 12 is plotted as indicated in the figure. Theacceptable values of y must lie below this line because of the

12 specification on thefunction. Finally, the lines representing x

1

= 0 and x

2

= 0 are the coordinate axes of thefigure, and the

0 specification indicates that only positive values are acceptable. As aresult of these four constraints, we find that the acceptable values of y must lie withinthe four-sided figure indicated by the shaded lines. This area is called the

feasible region

.Straight lines are then plotted on the chart for different values of y = constant = 2x

2

+3x

1

. These lines all have a slope of

1.5 and a y-intercept of y/2. All points on the line y= 30 lie outside the feasible region, so y = 30 is an unacceptable solution. The line y = 24has one point that lies just in the feasible region and intersects this region at the uppermostcorner. There is no larger value of y that will lie in the acceptable region, so y = 24 is themaximum value for the stated constraints.

The line y = 8 lies entirely below the feasible region and thus cannot represent anacceptable solution. The line y = 10 just intersects the acceptable region at x

1

= 0 and x

2

=5. There is no smaller value of y that will ensure the line has a point inside the feasibleregion, so y = 10 is the minimum value that will satisfy the given constraints.

It can be shown that for linear problems acceptable minimum or maximum values ofthe objective function must always correspond to one of the vertices of the feasible region(see Reference 7). We can, therefore, state our final answers as

y = y

max

= 24 at x

1

= 0 and x

2

= 12

y = y

min

= 10 at x

1

= 0 and x

2

= 5

Later, we will see how this problem can be worked using Solver.The second optimization problem we consider has an objective function of

7326_C008.fm Page 176 Tuesday, March 7, 2006 6:20 AM

Page 192: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems

177

y = g = x

1

+ x

2

(8.5)

and the constraints

ƒ

1

= 2x

2

+ 5x

1

30

ƒ

2

= x

12

+ x

22

36

ƒ

3

= x

2

12 (8.6)

ƒ

4

= x

1

0

ƒ

5

= x

2

0

Because of the nature of

ƒ

2

, this is a nonlinear problem. The graphical display for thisproblem is shown in Figure 8.2. First, the line 2x

2

+ 3x

1

= 30 is plotted as shown. Acceptablesolutions must lie below this line because of the

30 constraint. The nonlinear (circle)constraint is plotted as a quarter circle, and the solution must lie to the top and rightbecause of the

ƒ

2

36 specification. The line x

2

= 12 is drawn at the top of the figure, andacceptable solutions must lie below this line. Finally, the coordinate axes lines x

1

= 0 and

FIGURE 8.1

0

5

10

15

0 5 10 15

x1

x2y = 30

y = 24

2x1 + x2 = 12

x1 + x2 = 5

FeasibleRegion

y = 10

y = 8

7326_C008.fm Page 177 Tuesday, March 7, 2006 6:20 AM

Page 193: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

178

What Every Engineer Should Know About Excel

x

2

= 0 are drawn, and the acceptable solutions are restricted to positive values. The feasibleregion is the five-sided figure enclosed by the shaded lines.

Values of the objective function y = g = x

1

+ x

2

for y = constant are now drawn as straightlines with a slope of

1 and a y-intercept of y. The line y = 15 lies entirely outside thefeasible region, so y = 15 is an unacceptable solution. The line y = 14 just intersects thefeasible region at the upper-right corner located at x

1

= 2 and x

2

= 12. This is the largestvalue of y that will lie in the feasible region. For smaller values of y, we note that the liney = 6 just intersects the feasible region at two points: x

1

= 6, x

2

= 0 and x

1

= 0 , x

2

= 6. Anysmaller value of y will plot the line outside the feasible region. Thus, we have twominimums. Our final results are:

y = y

max

= 14 at x

1

= 2 and x

2

= 12

y = y

min

= 6 at x

1

= 0, x

2

= 6 or x

1

= 6, x

2

= 0

This solution may also be obtained using Solver.

FIGURE 8.2

0

5

10

15

0 5 10 15x1

x2

2x2 + 3x1 = 30

y = 12

y = 15

y = 6

x2 = 12

y = 8.485

7326_C008.fm Page 178 Tuesday, March 7, 2006 6:20 AM

Page 194: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems

179

8.3 Solutions Using Solver

To obtain solutions to the example optimization problems, the Solver worksheet is orga-nized in a fashion similar to that used for the solution of simultaneous equations. For thelinear example, the variables x

1

and x

2

are entered in cells B4 and B5 of Figure 8.3a. Solverwill iterate on these values to obtain a solution. The constraint function formulas areentered in cell B8 through B11 without the inequality conditions. They will be added inthe dialog box later. Finally, the objective (target) g function formula is entered in cell B14.At this point, the formula entries should be checked to see that they are correct.

Solver is now called up by clicking TOOLS/SOLVER. The Solver parameters windowappears as shown in Figure 8.3c. The target cell is set as the g function in cell B14, andthe inequality constraints are entered in accordance with Equation 8.6. For the maximiza-tion part of the problem, “max” is clicked in reference to the target function. The “ByChanging Cells” entries are the variable cells B4 and B5. Next, the Options button is clickedand the Solver Options window appears. Assume Linear Model is checked as the problemis linear. Zero values are entered as the initial guesses for the variable cells, then Solve isclicked, and the solution will appear in cells B4, B5, and B14 of Figure 8.3b. The operationis repeated for the minimization condition. The solutions to the maximization problemmay be taken as the initial guess for the minimization problem. The procedure is the sameas that for the maximization problem except for clicking min instead of max. Again, thesolutions will appear at cells B4, B5, and B14 of Figure 8.3e. The answers are the same asthose obtained graphically in Figure 8.1. The worksheet formulas and solution valuesappear as shown in Figure 8.3a.

The solution for the nonlinear problem is obtained in the same way as that for the linearproblem, except that Assume Linear Model is not checked. In this case there are fiveconstraint functions that are entered in cells B8 through B12. The formula for the objectiveg function is entered in cell B14. The solutions are shown in Figure 8.4.

FIGURE 8.3

456789

1011121314

A Bx1= 0x2= 0

f1= =2*B4+B5f2= =B4+B5f3= =B4f4= =B5

g=y= =2*B5+3*B4

456789

1011121314

A Bx1= 0x2= 12

f1= 12f2= 12f3= 0f4= 12

g=y= 24

(a) (b)

7326_C008.fm Page 179 Tuesday, March 7, 2006 6:20 AM

Page 195: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

180

What Every Engineer Should Know About Excel

The formulas for the maximization condition along with initial guesses of zero are shownin the upper-left corner of Figure 8.4. The resultant solution is to the right, and the valuesagree with the graphic solution obtained previously. The Solver Parameters window, withentries of the respective constraints, is shown in the center of Figure 8.4. The two solutionsfor the minimization condition are shown at the bottom of Figure 8.4. The left-hand-sidesolution is obtained with initial guesses of zero for cells B4 and B5. The right-hand-sidesolution is obtained with guesses taken as the solutions to the maximization problem, i.e.,x

1

= 2 and x

2

= 12. These results illustrate the fact again that there may be more than oneoptimum solution when nonlinear constraints are involved. We see that the specific min-imum point attained by Solver depends on the direction from which the solution isapproached. For a real-life physical problem, the best answer may be selected on the basisof other factors.

In the nonlinear example just described, both minimum values of the objective functionhad the same value: y = 6. Suppose the constraint x

2

0 is changed to x

2

1.0 and theinitial guesses are x

1

= 10 and x

2

= 6. Now the minimum value of y will be displayed as

FIGURE 8.3

(continued)

7326_C008.fm Page 180 Tuesday, March 7, 2006 6:20 AM

Page 196: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems

181

FIGURE 8.4

456789

1011121314

A Bx1= 0x2= 0

f1= =2*B5+3*B4f2= =B5f3= =B4^2+B5^2f4= B4f5= B5

g= =B4+B5

456789

1011121314

A Bx1= 2x2= 12

f1= 30f2= 12f3= 148f4= 2f5= 12

g= 14

456789

1011121314

A Bx1= 0x2= 6

f1= 12f2= 6f3= 36f4= 0f5= 6

g= 6

456789

1011121314

A Bx1= 6x2= 0

f1= 18f2= 0f3= 36f4= 6f5= 0

g= 6

7326_C008.fm Page 181 Tuesday, March 7, 2006 6:20 AM

Page 197: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

182

What Every Engineer Should Know About Excel

y = 6.91608 at the point x

1

= 5.91608 and x

2

= 1.0. Consulting Figure 8.2, we see that thisis just the intersection of x

2

= 1 and x

12

+ x

22

= 36, i.e., (36

1)

1/2

= 5.91608.If the solution is approached using x

1

= 0 and x

2

= 0, the objective function is given asbefore as 6.0 . We say that the first point at y = 6.91608 represents a local minimum, whereasthe second point represents an absolute minimum. The minimum points depend on theway the values are approached in the mathematical process. For this problem we have agraphical picture to guide us in assigning the names of local or absolute minimum values.The solution may not be so easy in problems with more than two variables. For nonlinearproblems, the correct solution may hinge upon the physical insight brought to the analysisby an astute engineer.

8.4 Solver Answer Reports for Examples

Upon deciding that a satisfactory solution has been obtained, we click Keep Solver Solutionin the Solver Results dialog window. At the same time, we may call for the Answer Report,which will then be available as a separate titled sheet in the workbook. The Answer Reportsfor the linear optimization problem are shown in figure on page 183.

We note that thetarget (objective function) and adjustable cell values are displayed for the start of iteration(initial guesses), and the final values after all the constraints have been satisfied. The finalƒ function values are displayed in the Constraints box along with their respective con-straint formulas. Under Status, the term binding means that the constraint applies to thefinal solution. The term not binding means there is a certain slack between the constraintand the final solution. These slack values are also displayed. In the maximization example,two of the constraints are binding and two are not binding. A zero slack results when aconstraint is binding.

The Answer Report for the minimization example shows an initial value of the g functionas 24 — the final result of the maximization problem. The original values for the adjustablecells are also taken as the final values for the maximization problem. As in the maximi-zation problem, two of the constraints are binding and two are not binding.

The Answer Reports for the nonlinear optimization problem are shown in figure onpage 184. The original guesses are taken as zero for the maximization problem, and thefinal values of the target and adjustable cell values are indicated. For this case, two of theconstraints are binding and three are not binding. Again, when a constraint is binding,we note that its slack is zero. The minimization problem starts with initial guesses takenas the answers from the maximization problem. There are two binding constraints for thiscase and three not-binding constraints.

The Answer Report sheets are preformatted in a style suitable for report presentationor transfer to another document.

7326_C008.fm Page 182 Tuesday, March 7, 2006 6:20 AM

Page 198: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems 183

FIGURE 8.5

Target Cell (Max)Cell Name Original Value Final Value

$B$14 g=y= 0 24

Adjustable CellsCell Name Original Value Final Value

$B$4 x1= 0 0$B$5 x2= 0 12

ConstraintsCell Name Cell Value Formula Status Slack

$B$9 f2= 12 $B$9>=5 Not Binding 7$B$8 f1= 12 $B$8<=12 Binding 0$B$10 f3= 0 $B$10>=0 Binding 0$B$11 f4= 12 $B$11>=0 Not Binding 12

Target Cell (Min)Cell Name Original Value Final Value

$B$14 g=y= 24 10

Adjustable CellsCell Name Original Value Final Value

$B$4 x1= 0 0$B$5 x2= 12 5

ConstraintsCell Name Cell Value Formula Status Slack

$B$9 f2= 5 $B$9>=5 Binding 0$B$8 f1= 5 $B$8<=12 Not Binding 7$B$10 f3= 0 $B$10>=0 Binding 0$B$11 f4= 5 $B$11>=0 Not Binding 5

7326_C008.fm Page 183 Tuesday, March 7, 2006 6:20 AM

Page 199: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

184 What Every Engineer Should Know About Excel

FIGURE 8.6

Target Cell (Max)Cell Name Original Value Final Value

$B$14 g= 0 14

Adjustable CellsCell Name Original Value Final Value

$B$4 x1= 0 2$B$5 x2= 0 12

ConstraintsCell Name Cell Value Formula Status Slack

$B$8 f1= 30 $B$8<=30 Binding 0$B$10 f3= 148 $B$10>=36 Not Binding 112$B$9 f2= 12 $B$9<=12 Binding 0$B$4 x1= 2 $B$4>=0 Not Binding 2$B$5 x2= 12 $B$5>=0 Not Binding 12

Target Cell (Min)Cell Name Original Value Final Value

$B$14 g= 14 6.000000012

Adjustable CellsCell Name Original Value Final Value

$B$4 x1= 2 0$B$5 x2= 12 6.000000012

ConstraintsCell Name Cell Value Formula Status Slack

$B$8 f1= 12.00000002 $B$8<=30 Not Binding 17.99999998$B$10 f3= 36.00000014 $B$10>=36 Binding 0$B$9 f2= 6.000000012 $B$9<=12 Not Binding 5.999999988$B$4 x1= 0 $B$4>=0 Binding 0$B$5 x2= 6.000000012 $B$5>=0 Not Binding 6.000000012

7326_C008.fm Page 184 Tuesday, March 7, 2006 6:20 AM

Page 200: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems 185

8.5 Nomenclature for Sensitivity Reports

If the Assume Linear Model box is checked, the following additional information isprovided for each changing cell:

The information provided for each constraint cell is as follows:

Reduced gradient This indicates the rate of change of the target cell perunit change in the changing cell.

Lagrange multiplier This indicates the rate of change of the target cell perunit increase in the respective constraint.

Reduced cost This replaces reduced gradient.

Objective coefficient This indicates the relative relationship between achanging cell and the target cell.

Allowable increase This indicates the change that must be present in theobjective coefficient until there is a correspondingincrease in the optimal value of any of the changingcells.

Allowable decrease This indicates the change that must be present in theobjective coefficient before there is a correspondingdecrease in the optimal value of any of the changingcells.

Shadow price This replaces the Lagrange multiplier and indicates theincrease of the target per unit increase in the right-hand (RH) side of the constraint equation.

Constraint RH side This indicates the constraint values specified in theproblem.

Allowable increase This indicates the change that may be present in theconstraint RH side value before there is an increase inthe optimal value of any of the changing cells.

Allowable decrease This indicates the change that may be present in theconstraint RH side value before there is a decrease inthe optimal value of any of the changing cells.

7326_C008.fm Page 185 Tuesday, March 7, 2006 6:20 AM

Page 201: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

186 What Every Engineer Should Know About Excel

8.6 Nomenclature for Answer Reports

8.7 Nomenclature for Limits Reports

Problems

8.1 Maximize or minimize the following y functions using Excel Solver:

a. y = 3x1 + 4x2

subject to the constraints

x1 + x2 ≥ 5

x1 + 2x2 ≤ 10

x1 ≥ 0

x2 ≥ 0

Target cell This is given as entered in the Solver dialog box.

Status column, binding This indicates that the final cell value equals theconstraint value.

Status column, not bind-ing

This indicates that the final cell value is differentfrom the constraint value but that the constraintcondition is met.

Slack column This indicates the difference between the final cellvalue at solution and the constraint value. For allbinding cells, the slack is zero.

Lower limit This indicates the smallest value that a changing cell may havewhile holding all the other changing cells constant, still satisfy-ing all the constraints.

Upper limit This indicates the largest value that a changing cell may havewhile holding all the other changing cells constant, still satisfy-ing the constraints.

Target result This indicates the value of the target cell when the changingcell takes on its lower or upper limit.

7326_C008.fm Page 186 Tuesday, March 7, 2006 6:20 AM

Page 202: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems 187

b. y = x1 + 3x2

subject to the constraints

x1 + x2 ≥ 3

2x1 + 3x2 ≤ 11

x1 ≥ 0

x2 ≥ 0

c. y = 5x1 + x2

subject to the constraints

x1 + x2 ≥ 7

3x1 + 2x2 ≥ 10

x1≥ 0

x2 ≥ 0

d. y = 50x1 + 40 x2

subject to the constraints

x1 + x2 ≥ 900

6x1 + x2 ≥ 9000

x1 ≥ 0

x2 ≥ 0

e. y = 15x1 + 20x2

subject to the constraints

2x1 + 5x2 ≥ 700

x1 + 5x2 ≥ 8000

x1 ≥ 0

x2 ≥ 0

7326_C008.fm Page 187 Tuesday, March 7, 2006 6:20 AM

Page 203: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

188 What Every Engineer Should Know About Excel

8.2 Using Excel Solver, maximize or minimize the following y functions subject to thegiven constraints:

a. y = x1 + x2

subject to the constraints

3x1 + 2x2 ≤ 30

x12 + x2

2 ≥ 36

x2 ≤ 10

x1 ≥ 0

x2 ≥ 0

b. y = x1 + x2

subject to the constraints

x2 ≤ 14

x12 + x2

2 ≥ 49

x1 ≥ 0

x2 ≥ 0

c. y = x1 + x2

subject to the constraints

x2 ≤ 11

2x12 + 3x2

2 ≥ 100

x1 ≥ 0

x2 ≥ 0

d. y = x1 + x2

subject to the constraints

x2 ≤ 13

2x12 + 3x2

1.8 ≥ 90

7326_C008.fm Page 188 Tuesday, March 7, 2006 6:20 AM

Page 204: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Optimization Problems 189

x1 ≥ 0

x2 ≥ 0

e. y = x11.5 + x2 1.5 + 3

subject to the constraints

x2 ≤ 15

x12 + x2

2 ≥ 36

x1 ≥ 0

x2 ≥ 0

8.3 Minimize

y = 10000x12 + 170x2

subject to the constraints

70/x12 ≥ K for K = 1, 2, 3, 4, 5, 6, 7, 8

x2 − 160000/x15 = 0

What do you conclude from these calculations?

8.4 Maximize the function

y = [ln(x2/x1)/0.05 + 0.2/x2]−1

subject to the constraints

x2 ≥ 0

x1 − K ≥ 0

where K is a constant that takes on the values 0.001, 0.005, 0.007, 0.015, and 0.02.

What do you conclude from these calculations?

7326_C008.fm Page 189 Tuesday, March 7, 2006 6:20 AM

Page 205: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C008.fm Page 190 Tuesday, March 7, 2006 6:20 AM

Page 206: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

191

9

Pivot Tables

9.1 Introduction

Pivot tables are most frequently employed to rearrange, regroup, modify, or analyze dataappearing in lists or tables. The name

pivot

comes from the fact that the tables are devicesfor “twisting” or “pivoting” data around a central core of information. Examples of theiruse include rearranging and presenting sales or manufacturing data by region or productgroups and subgroups, profit and supply schedules for different items, or other applica-tions primarily concerned with business situations. Because of the way they operate, pivottables may also be used effectively to arrange, modify, and present engineering data fromdifferent perspectives. They also offer graphing and charting features that can be quiteuseful.

As with some other topics we have discussed, we will not present a general discussionof pivot tables, but will rely on specific examples to illustrate their utility and capabilities.Important terms will be defined as the examples progress and different Windows optionswill be explained as needed. Readers may expand their knowledge of the topic by con-sulting the Help/Index feature of Excel, and we will suggest such consultation from timeto time.

Two Excel items are necessary for entry into all pivot table applications:

1. The PivotTable toolbar is displayed by clicking VIEW/TOOLBARS/PivotTable.The window for this toolbar is shown in Figure 9.1. Dragging the cursor alongthe icons will indicate some of the operations the toolbar performs.

2. The PivotTable Wizard is entered by either of the following:a. Clicking the Wizard icon on the toolbar (first icon to the right of PivotTable).b. Clicking DATA/PIVOTTABLE REPORT.

Clicking the PivotTable button on the toolbar produces a menu of other items as shownin Figure 9.2. We now offer several examples that illustrate features of pivot tables thatmay be useful for presentation and analysis of engineering data.

Example 9.1 Analysis of Performance of Air-Conditioning Unit

The performance data of the air-conditioning unit of Example 6.13 is displayed in columnsA,B, and C of Figure 9.3. Column D has been added to furnish data for the electric workinput W (in units of kW) for the unit. The terms in the table are thus defined as:

T

ew

= inside wet bulb temperature,

°

FT

c

= outside air temperature for unit,

°

F

7326_C009.fm Page 191 Tuesday, March 7, 2006 6:20 AM

Page 207: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

192

What Every Engineer Should Know About Excel

Q

ew

= cooling performance of the unit, kBtu/hW = electric power input, kW

In addition, two other parameters are important:

EER = Q

ew

/W = energy efficiency ratio (9.1)

FIGURE 9.1

FIGURE 9.2

7326_C009.fm Page 192 Tuesday, March 7, 2006 6:20 AM

Page 208: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

193

Q

h

= Q

ew

+ 3.413W = heat dissipated by unit, kBtu/h (9.2)

We will use the pivot table feature of Excel to analyze these parameters. First, we willexamine just T

ew

, T

c

, and Q

ew

(somewhat repeating Example 6.13) to show the pivot tableoperational features while keeping the presentation very simple.

A pivot table is created with the following procedure:

1. Activate columns A,B, and C of Figure 9.3. These are the data to be analyzed.2. Engage the PivotTable Wizard by one of the two methods noted in Section 9.1.

The Wizard window will appear as shown in Figure 9.4a. Note that the data rangeis that selected in step 1.

3. Click Next. The window at Figure 9.4b will appear. At the right side of the windowappear the three data fields (Tew, Tc, and Qew) that we wish to analyze or arrange.Later, we will add W, EER, and Qh as data fields for analysis.

4. We choose to display the respective fields by dragging Tew to the row location,Tc to the column location, and Qew to the body of the table (Data Field). Thesechoices are shown in Figure 9.4c. Note that the term Sum of Qew appears. Bydefault, Excel displays the sum of all values of Qew for a set of Tew and Tc values.There is only one value of Qew for each set in the data, so this default is the sameas listing the values of Qew. For now, then, ignore the Sum nomenclature. Later,we will see that it is possible to perform other functional manipulations of the data.

5. Click Next and choose “This Worksheet.” Then click finish. The pivot table willappear as shown in Figure 9.5a. Note the appearance of the Grand Total field,which sums the row and column values of Qew. These sums are of no interestand can be removed by clicking Options on the pivot table menu (last entry inthe menu list of Figure 9.2). The window of Figure 9.5b will appear. Remove the

FIGURE 9.3

123456789

10111213141516171819

A B C D

Tew Tc Qew W72 85 54.3 4.0272 95 51.8 4.5272 105 49.4 5.0772 115 46.6 5.6667 85 50.4 3.9967 95 48 4.4967 105 45.5 5.0267 115 42.9 5.662 85 46.5 3.9662 95 44.4 4.4462 105 42.2 4.9762 115 40 5.5457 85 45.7 3.9557 95 43.9 4.4457 105 42 4.9757 115 40 5.55

7326_C009.fm Page 193 Tuesday, March 7, 2006 6:20 AM

Page 209: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

194

What Every Engineer Should Know About Excel

FIGURE 9.4

7326_C009.fm Page 194 Tuesday, March 7, 2006 6:20 AM

Page 210: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

195

checks from the Grand Total boxes, and the revised version of the pivot table willappear as in Figure 9.5c.

At this point we note that the placement of the Tew, Tc, and Qew fields may be alteredto change the way the data are displayed. For now, we show how the data may bedisplayed on charts. Figure 9.5d is obtained by the following:

1. Click the upper-left corner of pivot table (Sum of Qew). This activates the datatable.

2. Chart Wizard is then clicked and a type 5 (see Section 3.3) scatter graph is selected(point-to-point line segments with data markers).

3. The chart will appear with color displays. Adjustments in format are made toproduce the black-and-white display shown. See Chapter 3 for information onformat and cosmetic adjustments.

FIGURE 9.5

Sum of Qew TcTew 85 95 105 115 Grand Total

57 45.7 43.9 42 40 171.662 46.5 44.4 42.2 40 173.167 50.4 48 45.5 42.9 186.872 54.3 51.8 49.4 46.6 202.1

Grand Total 196.9 188.1 179.1 169.5 733.6

Sum of Qew TcTew 85 95 105 115

57 45.7 43.9 42 4062 46.5 44.4 42.2 4067 50.4 48 45.5 42.972 54.3 51.8 49.4 46.6

35

40

45

50

55

55 60 65 70 75

Tew

Qew

85

95

105

115

(a)

(b)

(c)

(d)

7326_C009.fm Page 195 Tuesday, March 7, 2006 6:20 AM

Page 211: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

196

What Every Engineer Should Know About Excel

An alternate display of the pivot table data is shown in Figure 9.5e as an area chart with3-D visual effects. This chart will also appear in color, but is printed here in shades ofgray. Again, see Chapter 3 for format and cosmetic instructions.

Although one would normally treat Tew and Tc as the entry variables to obtain a valueof Qew, a situation might arise in which values of Tew and Tc that will produce a specificperformance cooling value of Qew are sought. The pivot table can accommodate this typeof request.

First, the pivot table of Figure 9.5a is activated. Then, the PivotTable Wizard is engagedto produce the new assignment of fields shown in Figure 9.6a, with Tc assigned to thedata field, Qew to the row field, and Tew to the column field. The resulting pivot table isshown in Figure 9.6b. Note that there are several empty cells in the body of the table. Ifa type 5 scatter graph is attempted, as before, one must first decide what to do with theseempty cells. The procedure is as follows: click TOOLS/OPTIONS/CHART. The windowshown in Figure 9.6c will appear. Interpolated is checked under Active Chart/Plot Empty

FIGURE 9.5

(continued)

7326_C009.fm Page 196 Tuesday, March 7, 2006 6:20 AM

Page 212: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

197

Cells. Click OK. A type 5 scatter graph is then plotted as shown in Figure 9.6d withcosmetic and format adjustments.

Finally, if one has the artistic inclination, a 3-D performance chart map of the pivot tablein Figure 9.5b may be displayed as shown in Figure 9.5f using a surface chart with 3-Dwire frame.

(a)

(b)

FIGURE 9.6

Sum of Tc TewQew 57 62 67 72

40 115 11542 105

42.2 10542.9 11543.9 9544.4 9545.5 10545.7 8546.5 8546.6 115

48 9549.4 10550.4 8551.8 9554.3 85

7326_C009.fm Page 197 Tuesday, March 7, 2006 6:20 AM

Page 213: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

198

What Every Engineer Should Know About Excel

Example 9.2 Introducing Calculated Data Fields in Pivot Tables

In this example we see how to enter the additional data fields W, EER, and Q

h

into thepivot table of Example 9.1. The last two are “calculated” from two of the other fields, Qewand W. The calculations could be performed on the worksheet, but we will see how theymay be executed in the pivot table creation process to illustrate that particular feature ofthe analysis.

First, all four columns of Figure 9.3 are activated and then the Pivot Table Wizardengaged to produce the window in Figure 9.7 and the pivot table in Figure 9.8. Note thatboth Qew and W are displayed in the body of the table as functions of Tew and Tc.Activating this table and selecting Column Chart/3-D Columns with the Chart Wizardproduces the result shown in Figure 9.9. This is a nice display but of little practical utility.

(c)

(d)

FIGURE 9.6

(continued)

85

90

95

100

105

110

115

40 42 44 46 48 50 52 54 56

Qew

Tc

57

62

67

72

7326_C009.fm Page 198 Tuesday, March 7, 2006 6:20 AM

Page 214: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

199

To insert the calculated values of EER and Qh as data fields, the PivotTable button isclicked on the toolbar of Figure 9.1, producing Figure 9.2. Formulas is checked, followedby Calculated Field, producing the window of Figure 9.10. Then EER is entered underName and the formula = Qew/W entered as shown. Add is clicked. The process is repeatedfor Qh with the formula = Qew + 3.413

×

W. All four data fields may now be entered inthe PivotTable Wizard to produce the window at Figure 9.11 and the pivot table at Figure9.12. The fields may be moved in and out of the pivot table as desired and appropriategraphs constructed to display the data. Figure 9.13 shows the pivot table for Qh alongwith scatter and 3-D area graphs.

FIGURE 9.7

FIGURE 9.8

TcTew Data 85 95 105 115

57 Sum of Qew 45.7 43.9 42 40Sum of W 3.95 4.44 4.97 5.55

62 Sum of Qew 46.5 44.4 42.2 40Sum of W 3.96 4.44 4.97 5.54

67 Sum of Qew 50.4 48 45.5 42.9Sum of W 3.99 4.49 5.02 5.6

72 Sum of Qew 54.3 51.8 49.4 46.6Sum of W 4.02 4.52 5.07 5.66

7326_C009.fm Page 199 Tuesday, March 7, 2006 6:20 AM

Page 215: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

200

What Every Engineer Should Know About Excel

Example 9.3 Addition of Regression Results to Pivot Table

It is a simple matter to add the results of the linear regression analysis of Example 6.13to the pivot tables for Qew presented in the preceding text. The results of the regressionfor Qew as a function of Tew and Tc and written in format for entry in the pivot tablebecomes:

Qewr = 0.526

×

Tew

0.228

×

Tc + 34.723 (9.3)

where we now use the symbol Qewr to designate the result of the linear regressionanalysis. The deviation from the original tabular values may be written as DevQewr and

DevQewr = Qew

Qewr (9.4)

FIGURE 9.9

FIGURE 9.10

7326_C009.fm Page 200 Tuesday, March 7, 2006 6:20 AM

Page 216: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

201

or, the percent deviation as

%DevQewr = (DevQewr/Qew)

×

100 (9.5)

The formulas in the preceding equations may be entered in the pivot table of Example9.1, producing the window of Figure 9.14. The resulting pivot table for data fields of Qew,Qewr, DevQewr, and %DevQewr is displayed in Figure 9.15. Graphical presentations ofthe results are easily obtained as outlined in the previous examples.

FIGURE 9.11

FIGURE 9.12

TcTew Data 85 95 105 115

57 Sum of Qew 45.7 43.9 42 40Sum of W 3.95 4.44 4.97 5.55Sum of Qh 59.18135 59.05372 58.96261 58.94215Sum of EER 11.56962025 9.887387387 8.450704225 7.207207207

62 Sum of Qew 46.5 44.4 42.2 40Sum of W 3.96 4.44 4.97 5.54Sum of Qh 60.01548 59.55372 59.16261 58.90802Sum of EER 11.74242424 10 8.490945674 7.220216606

67 Sum of Qew 50.4 48 45.5 42.9Sum of W 3.99 4.49 5.02 5.6Sum of Qh 64.01787 63.32437 62.63326 62.0128Sum of EER 12.63157895 10.69042316 9.06374502 7.660714286

72 Sum of Qew 54.3 51.8 49.4 46.6Sum of W 4.02 4.52 5.07 5.66Sum of Qh 68.02026 67.22676 66.70391 65.91758Sum of EER 13.50746269 11.46017699 9.743589744 8.233215548

7326_C009.fm Page 201 Tuesday, March 7, 2006 6:20 AM

Page 217: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

202

What Every Engineer Should Know About Excel

FIGURE 9.13

7326_C009.fm Page 202 Tuesday, March 7, 2006 6:20 AM

Page 218: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

203

FIGURE 9.14

FIGURE 9.15

TcTew Data 85 95 105 115

57 Sum ofQew 45.7 43.9 42 40Sum ofW 3.95 4.44 4.97 5.55Sum ofQewr 45.325 43.045 40.765 38.485Sum ofDevQewr 0.375 0.855 1.235 1.515Sum of%DevQewr 0.820568928 1.9476082 2.94047619 3.7875

62 Sum ofQew 46.5 44.4 42.2 40Sum ofW 3.96 4.44 4.97 5.54Sum ofQewr 47.955 45.675 43.395 41.115Sum ofDevQewr -1.455 -1.275 -1.195 -1.115Sum of%DevQewr -3.129032258 -2.871621622 -2.831753555 -2.7875

67 Sum ofQew 50.4 48 45.5 42.9Sum ofW 3.99 4.49 5.02 5.6Sum ofQewr 50.585 48.305 46.025 43.745Sum ofDevQewr -0.185 -0.305 -0.525 -0.845Sum of%DevQewr -0.367063492 -0.635416667 -1.153846154 -1.96969697

72 Sum ofQew 54.3 51.8 49.4 46.6Sum ofW 4.02 4.52 5.07 5.66Sum ofQewr 53.215 50.935 48.655 46.375Sum ofDevQewr 1.085 0.865 0.745 0.225Sum of%DevQewr 1.998158379 1.66988417 1.508097166 0.482832618

7326_C009.fm Page 203 Tuesday, March 7, 2006 6:20 AM

Page 219: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

204

What Every Engineer Should Know About Excel

9.2 Other Summary Functions for Data Fields

As noted in Example 9.1, the Excel default pivot table displays sums of the data items foreach set of row and column values. When there is only one value for each set, as in theprevious examples, the sum action is of no consequence. If multiple values are present inthe data, Excel provides other choices for the data presentation in addition to the sumfunction. These choices may be displayed and set by the following procedure:

1. Double-click the respective data field entry in step 3 of the procedure to create apivot table using PivotTable Wizard.

2. For Qew the resulting window shown in Figure 9.16 will appear. The functionchoices for summary of the data are:SumCountAverageMaxMinProductCount numberStdDevStdDevpVarVarp

3. Row and column fields may also be manipulated in different ways by double-clicking and selecting from a similar set of choices. The result of such action forthe Tew row is shown in Figure 9.17. In the case of rows and columns, Subtotalsare obtained in contrast to the Grand Totals described previously. These subtotals

FIGURE 9.16

7326_C009.fm Page 204 Tuesday, March 7, 2006 6:20 AM

Page 220: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

205

may be deleted from the pivot table presentation by clicking None as a choice inFigure 9.17. Selection of Automatic displays the subtotals.

To remove grand totals, on the PivotTable toolbar click PIVOTTABLE/OPTIONS/remove the check from Grand Totals (see Figure 9.2 and Figure 9.5b). To remove subtotals,double-click row or column fields in PivotTable. A window similar to that shown in Figure9.17 will appear. Click None.

Example 9.4 Pivot Table for Basic Financial Functions

As another example, we now show how pivot tables may be employed to calculate andpresent the basic financial functions of Section 7.3. The formulas are repeated here forconvenience:

fv = (1 + I)

n

(9.6)

pmt = I/[1

(1 + I)

n

] (9.7)

pv = [1

(1 + I)

n

]/I (9.8)

fvp = [(1 + I)

n

1]/I (9.9)

where we now use the symbol fvp to designate the future value of uniform periodicpayments. The formulas may alternately be expressed in terms of fv calculated fromEquation 9.6 as:

FIGURE 9.17

7326_C009.fm Page 205 Tuesday, March 7, 2006 6:20 AM

Page 221: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

206

What Every Engineer Should Know About Excel

pmt = I/(1

1/fv)

pv = (1

1/fv)/I

fvp = (fv

1)/I

A table is set up as shown in Figure 9.18 for I values of 3,4,5, and 6% and n values of5,10,15,20,25, and 30 periods in columns A and B. The values of fv are calculated in columnC using Equation 9.6. The table is then activated and the PivotTable Wizard engaged toproduce the data fields as shown in Figure 9.19. Subsequently, the other functions are addedas calculated data fields, as illustrated for fvp in the window of Figure 9.20. The pivot tabledisplaying all the resulting data is shown in Figure 9.21. Pivot tables for the fv and fvpfunctions are shown in Figure 9.22 and Figure 9.23, respectively, along with type 3 scattergraphs (see Section 3.3; smoothed curves and no data markers) of the data. In both cases,graphs are presented alternately with n and I as the abscissa. Finally, Figure 9.24 gives the

FIGURE 9.18

123456789

10111213141516171819202122232425

A B CI n fv3 5 1.1592744 5 1.2166535 5 1.2762826 5 1.3382263 10 1.3439164 10 1.4802445 10 1.6288956 10 1.7908483 15 1.5579674 15 1.8009445 15 2.0789286 15 2.3965583 20 1.8061114 20 2.1911235 20 2.6532986 20 3.2071353 25 2.0937784 25 2.6658365 25 3.3863556 25 4.2918713 30 2.4272624 30 3.2433985 30 4.3219426 30 5.743491

7326_C009.fm Page 206 Tuesday, March 7, 2006 6:20 AM

Page 222: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

207

pivot table for fv and fvp combined along with a scatter graph of both functions. Separatescales have been used for each function as described in Section 3.14, with the scale for fv inreverse order to provide more contrast in the display. For a final presentation the legendtable would be replaced by a text box, leaving out the “Sum of” notations. Figure 9.24 is afuller display than would normally be used, but illustrates the adaptability of pivot tablesto creating such displays.

Although the financial functions could have been calculated directly on a worksheetand subsequently displayed in the respective graphs, the use of pivot tables offersincreased flexibility of presentation possibilities, with much less fuss about switchingcolumns and rows, clicking and dragging to select data for charts, etc.

9.3 Restrictions on Pivot Table Formulas

Several restrictions are placed on the way formulas are constructed to enter calculateddata fields in pivot tables. For engineering work, perhaps the most restrictive requirementis the fact that worksheet functions (EXP, SQRT, etc.) may not display a cell reference ordefined names as parameters in the syntax statements for the functions. Array referencesas used in the function BESSELJ(n,x) are also not permitted. In many cases, the restrictionscan be circumvented by setting up the formulas in terms of the data fields of the pivottable as was done in Example 9.2, Example 9.3, and Example 9.4. The reader should consultHelp/Index under “Syntax for calculated field and item formulas in pivot tables” forfurther information.

FIGURE 9.19

7326_C009.fm Page 207 Tuesday, March 7, 2006 6:20 AM

Page 223: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

208

What Every Engineer Should Know About Excel

9.3.1 Ordering of Data Fields and Resultant Graphs

A simple set of data for the four variables x, y, z, and t is shown in Figure 9.25 along withthe dialog window for setting up a pivot table. As illustrated, x is to be listed in a columnand the data fields y, z, and t listed correspondingly. The ordering sequence is from topto bottom on the data fields of the window, which produces ordering from left to rightfor columns in the pivot table or from top to bottom if rows are employed in the pivottable. This will result in a left-to-right ordering of y,z, and t in the column chart shown.The corresponding scatter chart is shown in the upper-left corner of Figure 9.26.

FIGURE 9.20

FIGURE 9.21

7326_C009.fm Page 208 Tuesday, March 7, 2006 6:20 AM

Page 224: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

209

Different abscissas for the charts may be chosen easily by simply selecting different columnentries in the dialog window, whereas the ordering of the data fields may be altered byadjusting the vertical sequence of the data fields. The results of changing the abscissas areshown in the other three scatter charts of Figure 9.26. The ordering of the data fields is notparticularly important in the scatter charts, but observe that the listing of the data fields inthe legend box is in the same order as the data fields in the dialog window for the pivottable. The pivot tables have not been displayed here so as to conserve space.

FIGURE 9.22

Sum of fv nI 5 10 15 20 25 30

3 1.159274074 1.343916379 1.557967417 1.806111235 2.09377793 2.4272624714 1.216652902 1.480244285 1.800943506 2.191123143 2.665836331 3.243397515 1.276281563 1.628894627 2.078928179 2.653297705 3.386354941 4.3219423756 1.338225578 1.790847697 2.396558193 3.207135472 4.29187072 5.743491173

1

1.5

2

2.5

3

3.5

4

4.5

5

5.5

6

5 10 15 20 25 30

n

fv

3

4

5

6

1

1.5

2

2.5

3

3.5

4

4.5

5

5.5

6

3 3.5 4 4.5 5 5.5 6

I

fv

5

10

15

20

25

30

7326_C009.fm Page 209 Tuesday, March 7, 2006 6:20 AM

Page 225: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

210

What Every Engineer Should Know About Excel

FIGURE 9.23

Sum of fvp In 3 4 5 6

5 5.30913581 5.41632256 5.52563125 5.6370929610 11.46387931 12.00610712 12.57789254 13.1807949415 18.59891389 20.02358764 21.57856359 23.2759698820 26.87037449 29.77807858 33.0659541 36.785591225 36.45926432 41.64590829 47.72709882 54.86451230 47.57541571 56.08493775 66.4388475 79.05818622

0

10

20

30

40

50

60

70

80

5 10 15 20 25 30

n

fvp

3

4

5

6

0

10

20

30

40

50

60

70

80

3 3.5 4 4.5 5 5.5 6

I

fvp

5

10

15

20

25

30

7326_C009.fm Page 210 Tuesday, March 7, 2006 6:20 AM

Page 226: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

211

FIGURE 9.24

7326_C009.fm Page 211 Tuesday, March 7, 2006 6:20 AM

Page 227: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

212

What Every Engineer Should Know About Excel

9.4 Calculating and Charting Single or Multiple Functions

ƒ

(x) vs. x Using Pivot Tables

In accordance with our previous discussion, a procedure for calculating functions

ƒ

(x)may be described as follows:

FIGURE 9.25

123456

A B C Dx y z t

1 2 5 62 3 6 73 4 7 84 5 8 95 6 9 10

7326_C009.fm Page 212 Tuesday, March 7, 2006 6:20 AM

Page 228: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

213

1. Open an Excel workbook. Column A will be used for values of x. The initial valueof x is assigned in cell C1. The increment in x, Dx, is assigned in cell E1. Enter theformula =C1 in cell A2. Enter the formula =A2+$E$1 in cell A3. Drag-copy cellA3 for as many rows as desired for the calculations: several hundred rows aresuggested to accommodate small increments in x. The upper-left portion of sheet1 will appear as shown in Figure 9.27a for x1 = 0 and Dx = 0.2.

2. Assign the desired values of x1 and Dx for the calculations.3. Display the PivotTable toolbar by clicking VIEW/TOOLBARS/PIVOTTABLE.

Click the Wizard icon on the PivotTable toolbar. In step 2, either select the rangeof x by dragging or typing in the blank noted. The illustration here (Figure 9.27bused A1:A7. As noted, many more rows will be available. Click Next.

4. Drag x to the ROW and also to DATA (it will most likely be removed from DATAlater). See Figure 9.23c. Click Next.

5. Choose either New Worksheet or Existing Worksheet. See Figure 9.28d. If ExistingWorksheet is chosen, click or specify a location away from the original data ofitem 1 (such as cell G1) to avoid covering the data. Click Finish. For the simpleillustration, the pivot table appears at G1 in Figure 9.28. Grand Totals is removedby clicking PIVOT TABLE/OPTIONS/remove checks from Grand Totals on thePivotTable toolbar.

6. The simple data for f(x) = x in the pivot table are activated and plotted in a scattergraph at C10:H23 as shown in Figure 9.28.

FIGURE 9.26

0

2

4

6

8

10

12

0 1 2 3 4 5 6

x

Sum of y

Sum of z

Sum of t

0

2

4

6

8

0

2

0 1 2 3 4 5 6 7

y

Sum of z

Sum of t

Sum of x

0

2

4

6

8

10

12

0 2 4 6 8 10

z

Sum of y

Sum of t

Sum of x

0

1

2

3

4

5

6

7

8

9

10

0 2 4 6 8 10 12

t

Sum of z

Sum of y

Sum of x

7326_C009.fm Page 213 Tuesday, March 7, 2006 6:20 AM

Page 229: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

214

What Every Engineer Should Know About Excel

FIGURE 9.27

1234567

A B C D Ex x1= 0 Dx= 0.2

00.20.40.60.8

1

(a)

(b)

(c)

(d)

7326_C009.fm Page 214 Tuesday, March 7, 2006 6:20 AM

Page 230: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

215

Additional functions of x are now entered in the pivot table by the following procedure:

1. Activate the pivot table by clicking the upper-left corner.2. Click PivotTable on the PivotTable toolbar. The menu shown in Figure 9.29a

appears. FORMULAS and CALCULATED FIELD are clicked, producing the win-dow shown in Figure 9.29b. Name the function under Name:, and insert theformula in the line provided. Several functions are shown as typical additions.For example, the formula for sin2x would be entered as = SIN(2*x). Click Add.Insert as many functions as desired, and then click OK. A new version of the pivottable will appear with the new functions added.

3. To move functions in and out of the pivot table, first activate the table and thenclick the Wizard icon. A new window will appear, showing all the functions inthe DATA field. Drag functions in and out of the DATA field as desired and clickFinish. The new version of the pivot table will appear.

4. Remove Grand Totals as described earlier. Remove subtotals by double-clickingthe respective fields, producing a window offering choices for Subtotals. ClickNone.

5. Functions may be graphed singly or in multiples by activating the pivot table andusing Chart Wizard. Multiple function charts may become rather cluttered, anddiscretion is advised. A scatter chart for sin(nx) for n = 1 to 5 is shown in Figure9.30. The same functions are plotted as 3-D area charts in Figure 9.31. Note thereverse ordering of the functions.

FIGURE 9.28

1234567891011121314151617181920212223242526

A B C D E F G H Ix x1= 0 Dx= 0.2 Sumof x

Total0. 00. .2 0.20. .4 0.40. .6 0.6

.8 0.81. 11.41.61.8

22.22.42.62.8

33.23.43.63.8

44.24.44.64.8

Total

0

0.2

0.4

0.6

0.8

1

1.2

0 0.2 0.4 0.6 0.8 1 1.2

7326_C009.fm Page 215 Tuesday, March 7, 2006 6:20 AM

Page 231: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

216

What Every Engineer Should Know About Excel

9.5 Calculating and Plotting Functions of Two Variables

We have already seen in Example 9.4 the calculations for functions of two variables; inthis case, financial functions are functions of I and n. Because pivot tables cannot acceptarray formulas, it may sometimes be preferable to use the DATA/TABLE command forsuch calculations, as described in Section 2.16. However, pivot tables offer the advantageof easy entry of several functions into the table and quick subsequent manipulation ofthese functions. Taking the two entry variables as x and y, we wish to calculate the

ƒ

(x,y)values. Again, because of the nonarray entry requirements, all combinations of the vari-ables x and y must be present in the entry fields. Note in Figure 9.18 how this requirement

FIGURE 9.29

7326_C009.fm Page 216 Tuesday, March 7, 2006 6:20 AM

Page 232: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

217

FIGURE 9.30

FIGURE 9.31

sin(nx)

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0 1 2 3 4 5 6 7

x

sin(

nx)

7326_C009.fm Page 217 Tuesday, March 7, 2006 6:20 AM

Page 233: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

218

What Every Engineer Should Know About Excel

was met for the variables I and n. We consider another example — one from mechanicalvibrations. The functions to be calculated are:

a = amplitude function = x

2

/[(1 – x

2

)

2

+ (2xy)

2

]

0.5

(9.10)

a2 = second amplitude function = a/x

2

(9.11)

p = phase shift angle = tan

-1

[2xy/(1 – x

2

)] (9.12)

wherex =

ω

/

ω

n

= frequency ratioy = c/c

c

= damping ratio

The worksheet is opened as shown in Figure 9.32 and the values for x and y entered incolumns A and B for x = 0 to 2 in 0.1 increments and y-values of 0.25, 0.5, 0.7, and 1.0.The formulas corresponding to the three equations for a, a2, and p are entered in the pivottable and the calculated results plotted as shown in Figure 9.33.

FIGURE 9.32

123456789

10111213141516171819202122232425262728293031323334353637383940414243

A Bx y

0 0.250.1 0.250.2 0.250.3 0.250.4 0.250.5 0.250.6 0.250.7 0.250.8 0.250.9 0.25

1 0.251.1 0.251.2 0.251.3 0.251.4 0.251.5 0.251.6 0.251.7 0.251.8 0.251.9 0.25

2 0.250 0.5

0.1 0.50.2 0.50.3 0.50.4 0.50.5 0.50.6 0.50.7 0.50.8 0.50.9 0.5

1 0.51.1 0.51.2 0.51.3 0.51.4 0.51.5 0.51.6 0.51.7 0.51.8 0.51.9 0.5

2 0.5

Calculated FieldSolve Order Field Formula

1 a =x^2/(((1-x^2)^2+(2*x*y)^2)^0.5)2 a2 =a /(x^2)3 p =ATAN(2*y*x/(1-x^2))

Calculated ItemSolve Order Item Formula

Note: When a cell is updated by more than one formula,the value is set by the formula with the last solve order.

To change formula solve orders,use the Solve Order command on the PivotTable command bar.

7326_C009.fm Page 218 Tuesday, March 7, 2006 6:20 AM

Page 234: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

219

9.5.1 Display of Formulas and Solve Order

The formulas used in the pivot table may be displayed by:

a. Activating the pivot table by clicking the upper-left cellb. Clicking PIVOTTABLE/FORMULAS/LIST FORMULAS on the PivotTable toolbar

The result for this example is shown in Figure 9.32 along with a portion of the inputvalues for x and y. This display will appear on a new, separate sheet of the workbook.

FIGURE 9.33

0

0.5

1

1.5

2

2.5

0 0.5 1 1.5 2

w/wn

Am

plit

ude,

a

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 0.5 1 1.5 2

w/wn

Pha

se S

hift

0.1

1

10

0.1 1 10

w/wn

Am

plit

ude,

a2

7326_C009.fm Page 219 Tuesday, March 7, 2006 6:20 AM

Page 235: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

220

What Every Engineer Should Know About Excel

Problems

9.1 The following function occurs in an engineering design application:

e = 1 – exp{[exp(

NnC) – 1]/nC}

where

n = N

-0.22

Set up a pivot table to calculate values of e as a function of N and C for the ranges

0 < N < 5 and 0 < C < 1

Then, provide a graph for several values of these variables. Plot as e =

ƒ

(N) fordifferent values of C and also as e =

ƒ

(C) for selected values of N.

9.2 Set up a pivot table similar to that in Example 9.3 but for the exponential regressionof Example 6.14.

9.3 Set up a pivot table similar to that of Example 9.3 but based on the combinedregression analysis of Example 6.15.

9.4 Set up a pivot table to calculate P/B from Equation 7.11b for I = 3, 5, 7, 9, and12% with values of n = 5, 10, 15, 20, and 25 periods. Select values of C asappropriate. Note that values of C = I will result in division by zero, but selectingI = 3 and C = 2.99 will not produce an error notice. Provide a graph of P/B forone value of n.

9.5 Perform a second-order polynomial fit for the W(kW) data of Example 9.1 usinga single value of T

ew

= 57

°

F along with the four given values of T

c

. Obtain

W = aT

c2

+ bT

c

+ c for T

ew

= 57

°

F = constant

On a hot summer day in Dallas the temperature T

c

varies according to

T

c

= 93.5 + 8.5 sin(0.2618t – 2.8798)

where t is the time measured in hours from midnight. Using the combinationregression obtained for Qew in Example 6.15 construct a pivot table that will:

a. Present values of Qew(kBtu/h) as a function of tb. Present values of W(kW) as a function of tc. Sum the total cooling Qew(kBtu) and energy input W(kWh) over a 24-h periodd. Display values of T

c

as a function of t

7326_C009.fm Page 220 Tuesday, March 7, 2006 6:20 AM

Page 236: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

Pivot Tables

221

Using this information, plot Qew(kBtu/h) , W(kW) and T

c

as functions of t inhours.

9.6 The cooling load that the air-conditioning unit in Problem 9.5 must accommodatevariation with T

c

according to the relation:

Qload = Const

×[0.03704(Tc – 75) + 0.2332]

Assume that the unit is oversized such that it can deliver 10% more cooling thanthe maximum needed under the most severe temperature conditions, i.e., for Tc

= 102°F at 5 p.m. Devise additions to the pivot table of Problem 9.5 that willcalculate and display a duty cycle factor defined by

F = Qload(t)/Qew(t)

Plot the values of F as a function of t.

9.7 As the air-conditioning unit in Problem 9.5 and Problem 9.6 is oversized, a pro-posal is made to store the excess capacity by suitable means, viz., by storing chilledwater or making it available for other applications. Provide additions to the pivottable that will display the hourly Btu of excess capacity that will be available.

9.8 The particle displacement amplitude for a “standing” sound wave may be de-scribed by the relation

a = sin(2πx/λ)×cos2πct/λ + const)

where

x = spatial location, mλ = wavelength of the sound, mc = acoustic velocity, m/sect = time, sec

Devise a pivot table to display and graph a suitable range of values of the ampli-tude function for λ = 0.2 m and c = 344 m/sec.

9.9 The steady-state amplitude response of a first-order system to an impressed fre-quency ω is given by

a(t) = sin(ωt − φ)/[1 + (ωt)2]1/2

where φ is the phase shift angle defined by

φ = −tan−1(ωt)

Devise a pivot table to display this response. Plot the results on a suitable graph.

9.10 The time-delay behavior of a low-frequency (≈1 cycle per 24 hour) thermal wavein a large solid is described by the amplitude response equation:

7326_C009.fm Page 221 Tuesday, March 7, 2006 6:20 AM

Page 237: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

222 What Every Engineer Should Know About Excel

a(x,t) = exp[−(x2πω/α)0.5] × sin[2πωt − (x2πω/α)0.5]

where

x is the depth in the solid material, mω is the frequency of the thermal wave at x = 0, in cycles/sect is the time, secα = constant = 7×10-7 m2/sec

Construct a pivot table and appropriate charts to display the behavior of a(x,t)over at least two cycles of the impressed wave at x = 0. Also, examine the behaviorof a time delay function

Δt = (x2/4απω)1/2

9.11 A transient cooling problem involves the equation

θ = 1 – erf(X) – [exp(hx/k + h2αt/k2)]×{1 – erf[X + (h2αt/k2)0.5]}

= function of [X, (h2αt/k2)0.5]

where

X = (x2/4αt)0.5

α, h, k = constantsx = space coordinatet = time coordinate

Devise a pivot table to display values of θ in the range from 0.01 to 1.0 for rangesof the variables

0 < X < 1.5

0.05 < (h2αt/k2)0.5 < ∞

7326_C009.fm Page 222 Tuesday, March 7, 2006 6:20 AM

Page 238: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

223

References

1. Chapra, S.C., and Canale, T.P.,

Numerical Methods for Engineers,

McGraw-Hill, New York, 1985.

2. Hillier, F.S., and Lieberman, G.J.,

Introduction to Mathematical Programming,

2nd ed., McGraw-Hill, New York, 1995.

3. Holman, J.P.,

Experimental Methods for Engineers,

7th ed., McGraw-Hill, New York, 2000.4. Holman, J.P.,

Heat Transfer,

9th ed., McGraw-Hill, New York, 2002.5. Milton, J.S., and Arnold, J.C.,

Introduction to Probability and Statistics,

McGraw-Hill, New York,1990.

6. Thuesen, G.J. and Fabrycky, W.J.,

Engineering Economy

, 8th ed., Prentice-Hall, Englewood Cliffs,NJ, 1993.

7. Winston, W.L.,

Operations Research, Applications, and Algorithms

, 3rd ed., PWS-Kent, Boston,1994.

8. Wu, N. and R. Coppins,

Linear Programming

, McGraw-Hill, New York, 1981.

7326_C010.fm Page 223 Tuesday, March 7, 2006 6:21 AM

Page 239: What Every Engineer EXCEL - DropPDF1.droppdf.com/files/Udrqw/what-every-engineer... · About the Author J.P. Holman received a Ph.D. in mechanical engineering from Oklahoma State

7326_C010.fm Page 224 Tuesday, March 7, 2006 6:21 AM