ebook img

Introduction to MATLAB for Engineers, 3rd Edition PDF

577 Pages·2010·5.97 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Introduction to MATLAB for Engineers, 3rd Edition

pal34870_ifc.qxd 1/7/10 7:44 PM Page i Numbered Examples: Chapters One to Eight Numberand Topic Numberand Topic ChapterOne 4.7–1 Using the switchstructure for calendar calculations 1.1–1 Volume of a circular cylinder 4.9–1 Acollege enrollment model: Part I 1.6–1 Piston motion 4.9–2 Acollege enrollment model: Part II ChapterTwo ChapterFive 2.3–1 Vectors and displacement 5.2–1 Plotting orbits 2.3–2 Aortic pressure model 2.3–3 Transportation route analysis ChapterSix 2.3–4 Current and power dissipation in resistors 6.1–1 Temperature dynamics 2.3–5 Abatch distillation process 6.1–2 Hydraulic resistance 2.4–1 Miles traveled 6.2–1 Estimation of traf c ow 2.4–2 Height versus velocity 6.2–2 Modeling bacteria growth 2.4–3 Manufacturing cost analysis 6.2–3 Breaking strength and alloy 2.4–4 Product cost analysis composition 2.5–1 Earthquake-resistant building design 6.2–4 Response of a biomedical instrument 2.6–1 An environmental database 2.7–1 Astudent database ChapterSeven 7.1–1 Breaking strength of thread ChapterThree 7.2–1 Mean and standard deviation of heights 3.2–1 Optimization of an irrigation channel 7.2–2 Estimation of height distribution 7.3–1 Statistical analysis and manufacturing ChapterFour tolerances 4.3–1 Height and speed of a projectile 4.5–1 Series calculation with a forloop ChapterEight 4.5–2 Plotting with a forloop 8.1–1 The matrix inverse method 4.5–3 Data sorting 8.2–1 Left division method with three 4.5–4 Flight of an instrumented rocket unknowns 4.6–1 Series calculation with a whileloop 8.2–2 Calculations of cable tension 4.6–2 Growth of a bank account 8.2–3 An electric resistance network 4.6–3 Time to reach a speci ed height 8.2–4 Ethanol production pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page i Numbered Examples: Chapters Eight to Eleven Numberand Topic Numberand Topic 8.3–1 An underdetermined set with three ChapterTen equations and three unknowns # 10.2–1 Simulink solution ofy = 10sint 8.3–2 Astatically indeterminate problem 10.2–2 Exporting to the MATLAB workspace 8.3–3 Three equations in three unknowns, # 10.2–3 Simulink model fory = -10y + f(t) continued 10.3–1 Simulink model of a two-mass 8.3–4 Production planning suspension system 8.3–5 Traf c engineering 10.4–1 Simulink model of a rocket-propelled 8.4–1 The least-squares method sled 8.4–2 An overdetermined set 10.4–2 Model of a relay-controlled motor 10.5–1 Response with a dead zone ChapterNine 10.6–1 Model of a nonlinear pendulum 9.1–1 Velocity from an accelerometer 9.1–2 Evaluation of Fresnel(cid:146)s cosine integral ChapterEleven 9.1–3 Double integral over a nonrectangular region 11.3–1 Intersection of two circles 9.3–1 Response of an RCcircuit 11.3–2 Positioning a robot arm 9.3–2 Liquid height in a spherical tank 11.5–1 Topping the Green Monster 9.4–1 Anonlinear pendulum model 9.5–1 Trapezoidal pro le for a dc motor pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page iii ® Introduction to MATLAB for Engineers William J. Palm III University of Rhode Island TM pal34870_fm_i-xii_1.qxd 1/15/10 11:41 AM Page iv TM INTRODUCTION TO MATLABfiFOR ENGINEERS, THIRD EDITION Published by McGraw-Hill, a business unit of The McGraw-Hill Companies, Inc., 1221 Avenue of the Americas, New York, NY10020. Copyright '2011 by The McGraw-Hill Companies, Inc. All rights reserved. Previous editions '2005 and 2001. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or transmission, or broadcast for distance learning. Some ancillaries, including electronic and print components, may not be available to customers outside the United States. This book is printed on acid-free paper containing 10% postconsumer waste. 1 2 3 4 5 6 7 8 9 0 DOC/DOC 1 0 9 8 7 6 5 4 3 2 1 0 ISBN 978-0-07-353487-9 MHID 0-07-353487-0 Vice President & Editor-in-Chief: Martin Lange Vice President, EDP: Kimberly Meriwether David Global Publisher: Raghu Srinivasan Sponsoring Editor: Bill Stenquist Marketing Manager: Curt Reynolds Development Editor: Lora Neyens Senior Project Manager: Joyce Watters Design Coordinator: Margarite Reynolds Cover Designer: Rick D. Noel Photo Research: John Leland Cover Image: 'Ingram Publishing/AGE Fotostock Production Supervisor: Nicole Baumgartner Media Project Manager: Joyce Watters Compositor: MPS Limited, AMacmillan Company Typeface: 10/12 Times Roman Printer: RRDonnelly All credits appearing on page or at the end of the book are considered to be an extension of the copyright page. Library of Congress Cataloging-in-Publication Data Palm, William J. (William John), 1944(cid:150) Introduction to MATLAB for engineers / William J. Palm III.(cid:151)3rd ed. p. cm. Includes bibliographical references and index. ISBN 978-0-07-353487-9 1. MATLAB. 2. Numerical analysis(cid:151)Data processing. I. Title. QA297.P33 2011 518.0285(cid:151)dc22 2009051876 www.mhhe.com pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page v To my sisters, Linda and Chris, and to my parents, Lillian and William pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page vi A B O U T T H E A U T H O R William J.Palm III is Professor of Mechanical Engineering at the University of Rhode Island. In 1966 he received a B.S. from Loyola College in Baltimore, and in 1971 a Ph.D. in Mechanical Engineering and Astronautical Sciences from Northwestern University in Evanston, Illinois. During his 38 years as a faculty member, he has taught 19 courses. One of these is a freshman MATLAB course, which he helped develop. He has authored eight textbooks dealing with modeling and simulation, system dynamics, control systems,andMATLAB.TheseincludeSystemDynamics,2ndEdition(McGraw- Hill, 2010). He wrote a chapter on control systems in the Mechanical Engineers(cid:146) Handbook(M. Kutz, ed., Wiley, 1999), and was a special contributor to the fth editions of Staticsand Dynamics,both by J.L. Meriam and L. G. Kraige (Wiley, 2002). Professor Palm(cid:146)s research and industrial experience are in control systems, robotics, vibrations, and system modeling. He was the Director of the Robotics Research Center at the University of Rhode Island from 1985 to 1993, and is the coholder of a patent for a robot hand. He served as Acting Department Chair from 2002 to 2003. His industrial experience is in automated manufacturing; modeling and simulation of naval systems, including underwater vehicles and tracking systems; and design of control systems for underwater-vehicle engine- test facilities. vi pal34870_fm_i-xii_1.qxd 1/9/10 3:59 PM Page vii C O N T E N T S Preface ix 4 CHAPTER Programming with MATLAB 147 1 CHAPTER 4.1 Program Design and Development 148 An Overview of MATLAB® 3 4.2 Relational Operators and Logical 1.1 MATLAB Interactive Sessions 4 Variables 155 1.2 Menus and the Toolbar 16 4.3 Logical Operators and Functions 157 1.3 Arrays, Files, and Plots 18 4.4 Conditional Statements 164 1.4 Script Files and the Editor/Debugger 27 4.5 forLoops 171 1.5 The MATLAB Help System 33 4.6 whileLoops 183 1.6 Problem-Solving Methodologies 38 4.7 The switchStructure 188 1.7 Summary 46 4.8 Debugging MATLAB Programs 190 Problems 47 4.9 Applications to Simulation 193 4.10 Summary 199 2 CHAPTER Problems 200 Numeric, Cell, and Structure Arrays 53 2.1 One- and Two-Dimensional Numeric 5 Arrays 54 CHAPTER 2.2 Multidimensional Numeric Arrays 63 Advanced Plotting 219 2.3 Element-by-Element Operations 64 5.1 xyPlotting Functions 219 2.4 Matrix Operations 73 5.2 Additional Commands and 2.5 Polynomial Operations Using Arrays 85 Plot Types 226 2.6 Cell Arrays 90 5.3 Interactive Plotting in MATLAB 241 2.7 Structure Arrays 92 5.4 Three-Dimensional Plots 246 2.8 Summary 96 5.5 Summary 251 Problems 97 Problems 251 3 CHAPTER Functions and Files 113 CHAPTER 6 Model Building and Regression 263 3.1 Elementary Mathematical Functions 113 3.2 User-De ned Functions 119 6.1 Function Discovery 263 3.3 Additional Function Topics 130 6.2 Regression 271 3.4 Working with Data Files 138 6.3 The Basic Fitting Interface 282 3.5 Summary 140 6.4 Summary 285 Problems 140 Problems 286 vii pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page viii viii Contents 7 10.7 Subsystems 443 CHAPTER Statistics, Probability, and 10.8 Dead Time in Models 448 Interpolation 295 10.9 Simulation of a Nonlinear Vehicle Suspension Model 451 7.1 Statistics and Histograms 296 10.10 Summary 455 7.2 The Normal Distribution 301 Problems 456 7.3 Random Number Generation 307 7.4 Interpolation 313 1 1 CHAPTER 7.5 Summary 322 MuPAD 465 Problems 324 11.1 Introduction to MuPAD 466 CHAPTER 8 11.2 Symbolic Expressions and Algebra 472 LinearAlgebraic Equations 331 11.3 Algebraic and Transcendental Equations 479 8.1 Matrix Methods for Linear Equations 332 11.4 Linear Algebra 489 8.2 The Left Division Method 335 11.5 Calculus 493 8.3 Underdetermined Systems 341 11.6 Ordinary Differential Equations 501 8.4 Overdetermined Systems 350 11.7 Laplace Transforms 506 8.5 AGeneral Solution Program 354 11.8 Special Functions 512 8.6 Summary 356 11.9 Summary 514 Problems 357 Problems 515 9 CHAPTER A APPENDIX Numerical Methods forCalculus and Guide to Commands and Functions in Differential Equations 369 This Text 527 9.1 Numerical Integration 370 9.2 Numerical Differentiation 377 B APPENDIX 9.3 First-Order Differential Equations 382 Animation and Sound in MATLAB 538 9.4 Higher-Order Differential Equations 389 9.5 Special Methods for Linear Equations 395 C 9.6 Summary 408 APPENDIX Formatted Output in MATLAB 549 Problems 410 CHAPTER 1 0 APPENDIX D Simulink 419 References 553 10.1 Simulation Diagrams 420 10.2 Introduction to Simulink 421 APPENDIX E 10.3 Linear State-Variable Models 427 Some Project Suggestions www.mhhe.com/palm 10.4 Piecewise-Linear Models 430 10.5 Transfer-Function Models 437 Answers to Selected Problems 554 10.6 Nonlinear State-Variable Models 441 Index 557 pal34870_fm_i-xii_1.qxd 1/7/10 7:44 PM Page ix P R E FA C E F ormerly used mainly by specialists in signal processing and numerical analysis, MATLABfiin recent years has achieved widespread and enthusi- astic acceptance throughout the engineering community. Many engineer- ing schools now require a course based entirely or in part on MATLAB early in the curriculum. MATLAB is programmable and has the same logical, relational, conditional, and loop structures as other programming languages, such as Fortran, C, BASIC, and Pascal. Thus it can be used to teach programming principles. In most schools a MATLAB course has replaced the traditional Fortran course, and MATLAB is the principal computational tool used throughout the curriculum. In some technical specialties, such as signal processing and control systems, it is the standard software package for analysis and design. The popularity of MATLAB is partly due to its long history, and thus it is well developed and well tested. People trust its answers. Its popularity is also due to its user interface, which provides an easy-to-use interactive environment that includes extensive numerical computation and visualization capabilities. Its compactness is a big advantage. For example, you can solve a set of many linear algebraic equations with just three lines of code, a feat that is impossible with tra- ditional programming languages. MATLAB is also extensible; currently more than 20 (cid:147)toolboxes(cid:148) in various application areas can be used with MATLAB to add new commands and capabilities. MATLAB is available for MS Windows and Macintosh personal computers and for other operating systems. It is compatible across all these platforms, which enables users to share their programs, insights, and ideas. This text is based on MATLAB version 7.9 (R2009b). Some of the material in Chapter 9 is based on the control system toolbox, Version 8.4. Chapter 10 is based on Version 7.4 of Simulinkfi. Chapter 11 is based on Version 5.3 of the Symbolic Math toolbox. TEXTOBJECTIVES AND PREREQUISITES This text is intended as a stand-alone introduction to MATLAB. It can be used in an introductory course, as a self-study text, or as a supplementary text. The text(cid:146)s material is based on the author(cid:146)s experience in teaching a required two-credit semester course devoted to MATLAB for engineering freshmen. In addition, the text can serve as a reference for later use. The text(cid:146)s many tables and its referencing system in an appendix have been designed with this purpose in mind. A secondary objective is to introduce and reinforce the use of problem- solving methodology as practiced by the engineering profession in general and fiMATLAB and Simulink are a registered trademarks of The MathWorks, Inc. ix

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.