




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































MATLAB
® for Engineers
Third Edition
HOLLY M OORE Salt Lake Community College Salt Lake City, Utah
Boston • Columbus • Indianapolis • New York San Francisco • Upper Saddle River • Amsterdam Cape Town • Dubai • London • Madrid • Milan Munich • Paris • Montreal • Toronto • Delhi Mexico City • Sao Paulo • Sydney • Hong Kong Seoul • Singapore • Taipei • Tokyo
xi
About This Book
This book grew out of my experience teaching MATLAB ®^ and other computing languages to freshmen engineering students at Salt Lake Community College. I was frustrated by the lack of a text that “started at the beginning.” Although there were many comprehensive reference books, they assumed a level of both mathem- atical and computer sophistication that my students did not possess. Also, because MATLAB ®^ was originally adopted by practitioners in the fields of signal processing and electrical engineering, most of these texts provided examples primarily from those areas, an approach that didn’t fit with a general engineering curriculum. This text starts with basic algebra and shows how MATLAB ®^ can be used to solve engineering problems from a wide range of disciplines. The examples are drawn from concepts introduced in early chemistry and physics classes and freshman and sophomore engineering classes. A standard problem-solving methodology is used consistently. The text assumes that the student has a basic understanding of college algebra and has been introduced to trigonometric concepts; students who are mathematically more advanced generally progress through the material more rapidly. Although the text is not intended to teach subjects such as statistics or matrix algebra, when the MATLAB®^ techniques related to these subjects are introduced, a brief background is included. In addition, sections describing MATLAB®^ techniques for solving problems by means of calculus and differential equations are introduced near the end of appro- priate chapters. These sections can be assigned for additional study to students with a more advanced mathematics background, or they may be useful as reference material as students progress through an engineering curriculum. The book is intended to be a “hands-on” manual. My students have been most successful when they read the book while sitting beside a computer and typing in the examples as they go. Numerous examples are embedded in the text, with more com- plicated numbered examples included in each chapter to reinforce the concepts introduced. Practice exercises are included in each chapter to give students an immediate opportunity to use their new skills, and complete solutions are available online at: www.pearsonhighered.com/moore. The material is grouped into three sections. The first, An Introduction to Basic MATLAB ®^ Skills , gets the student started and contains the following chapters:
xii About This Book
Chapters 1 through 9 should be taught sequentially, but the chapters in Section 3, Advanced MATLAB ®^ Concepts , do not depend upon each other. Any or all of these chapters could be used in an introductory course or could serve as ref- erence material for self-study. Most of the material is appropriate for freshmen. A two-credit course might include Chapters 1 through 9 plus Chapter 10, while a three-credit course might include Chapters 1 through 14, but eliminate Sections 12.4, 12.5, 13.4, 13.5, and 13.6, which describe differentiation techniques, integration techniques, and solution techniques for differential equations. Chapters 15 and 16 will be interesting to more advanced students, and might be included in a course delivered to sophomore or junior students instead of to freshmen. The skills developed in these will be especially useful as students become more involved in solving engineering problems:
xiv About This Book
xv
Dedication and
Acknowledgments
This project would not have been possible without the support of my family, which endured reading multiple drafts of the text and ate a lot of frozen pizza while I con- centrated on writing. Thanks to Mike, Heidi, Meagan, and David, and to my hus- band, Dr. Steven Purcell. I also benefited greatly from the suggestions for problems related to electricity from Lee Brinton and Gene Riggs of the SLCC Electrical Engineering Department. Their cheerful efforts to educate me on the mysteries of electricity are much appreciated. I’d also like to thank Dr. Ghassan Hamarneh for his careful review of the second edition, which helped tremendously as I prepared this latest manuscript. This book is dedicated to my father, Professor George Moore, who taught in the Department of Electrical Engineering at the South Dakota School of Mines and Technology for almost 20 years. Professor Moore earned his college degree at the age of 54 after a successful career as a pilot in the United States Air Force and was a living reminder that you are never too old to learn. My mother, Jean Moore, encouraged both him and her two daughters to explore outside the box. Her loving support made it possible for both my sister and I to enjoy careers in engineering—something few women attempted in the early 1970s. I hope that readers of this text will take a minute to thank those people in their lives who’ve helped them make their dreams come true. Thanks Mom and Dad.
MATLAB®^ is one of a number of commercially available, sophisticated mathematical computation tools, which also include Maple, Mathematica, and MathCad. Despite what proponents may claim, no single one of these tools is “the best.” Each has strengths and weaknesses. Each allows you to perform basic mathematical computations. They differ in the way they handle symbolic calculations and more complicated mathemati- cal processes, such as matrix manipulation. For example, MATLAB®^ (short for Mat rix Lab oratory) excels at computations involving matrices, whereas Maple excels at sym- bolic calculations. At a fundamental level, you can think of these programs as sophisti- cated computer-based calculators. They can perform the same functions as your scientific calculator—and many more. If you have a computer on your desk, you may find yourself using MATLAB®^ instead of your calculator for even the simplest mathe- matical applications—for example, balancing your checkbook. In many engineering classes, the use of programs such as MATLAB®^ to perform computations is replacing more traditional computer programming. Although programs such as MATLAB®^ have become a standard tool for engineers and scientists, this doesn’t mean that you shouldn’t learn a high-level language such as C++, JAVA, or FORTRAN. Because MATLAB®^ is so easy to use, you can perform many programming tasks with it, but it isn’t always the best tool for a programming task. It excels at numerical calculations—especially matrix calculations—and graphics, but you wouldn’t want to
After reading this chapter, you should be able to:
Objectives
About MATLAB
®
C H A P T E R
2 Chapter 1 About MATLAB®
use it to write a word-processing program. For large applications, such as operating systems or design software, C++, JAVA, or FORTRAN would be the programs of choice. (In fact, MATLAB ®^ , which is a large application program, was originally written in FORTRAN and later rewritten in C, a precursor of C++.) Usually, high- level programs do not offer easy access to graphing—an application at which MATLAB®^ excels. The primary area of overlap between MATLAB®^ and high-level programs is “number crunching”—repetitive calculations or the processing of large quantities of data. Both MATLAB®^ and high-level programs are good at processing numbers. A “number-crunching” program is generally easier to write in MATLAB®, but usually it will execute faster in C++ or FORTRAN. The one exception to this rule is calculations involving matrices. MATLAB®^ is optimized for matrices. Thus, if a problem can be formulated with a matrix solution, MATLAB®^ executes substan- tially faster than a similar program in a high-level language. MATLAB®^ is available in both a professional and a student version. The profes- sional version is probably installed in your college or university computer laboratory, but you may enjoy having the student version at home. MATLAB®^ is updated regu- larly; this textbook is based on MATLAB®^ 7.12. If you are using earlier versions such as MATLAB®^ 6, you may notice some minor differences between it and MATLAB® 7.12. There are substantial differences in versions that predate MATLAB®^ 5.5. The standard installation of the professional version of MATLAB®^ is capable of solving a wide variety of technical problems. Additional capability is available in the form of function toolboxes. These toolboxes are purchased separately, and they may or may not be available to you. You can find a complete list of the MATLAB® product family at The MathWorks web site, www.mathworks.com.
The professional and student editions of MATLAB®^ are very similar. Beginning stu- dents probably won’t be able to tell the difference. Student editions are available for Microsoft Windows, Mac OSX, and Linux operating systems and can be purchased from college bookstores or online from The MathWorks at www.mathworks.com. The MathWorks packages its software in groups called releases , and MATLAB®^ 7. is featured, along with other products, such as Simulink®^ 7.7, in Release R2011a. New versions are released every 6 months. The release number is the same for both the stu- dent and professional edition, but the student version may lag the professional version by several months. The student edition of R2011a includes the following features:
KEY IDEA MATLAB ®^ is optimized for matrix calculations
KEY IDEA MATLAB ®^ is regularly updated