# A Guide to MATLAB for Beginners and Experienced Users ebook代购

 Contents at a Glance+ W; O9 d\$ E3 A  ^- F Preface page xiii: {* I2 c0 b# e1 P0 y 1 Getting Started 1 2 MATLAB Basics 84 k/ L: w" z: E7 J7 g 3 Interacting with MATLAB 31 Practice Set A: Algebra and Arithmetic 48 4 Beyond the Basics 50 5 MATLAB Graphics 67 Practice Set B: Calculus, Graphics, and Linear Algebra 86 6 M-Books 91 7 MATLAB Programming 1011 |" _6 \\$ q+ f( c0 @1 |+ O 8 SIMULINK and GUIs 121 9 Applications 136+ o, {, n& k0 }" K: G2 I Practice Set C: Developing Your MATLAB Skills 204! K' c# J7 r4 H1 w! X 10 MATLAB and the Internet 214 11 Troubleshooting 218 Solutions to the Practice Sets 235 Glossary 299. \8 p; \' x: D/ q, w" T Index 317/ q2 l7 M" Q: v9 ~' G3 |( O v% O& r! T' z# @: [" C6 L 2 w( H8 a2 h  F. A# t Contents Preface page xiii. C  G, K, \5 {  N\$ E 1 Getting Started 1' `' t8 v2 m' e8 o  _ Platforms and Versions 1* e7 b  X+ C5 ]# s3 V* R9 ~ Installation and Location 2 Starting MATLAB 2 Typing in the Command Window 3, z% t) ?2 z) n* ] Online Help 4/ p9 K0 s( c4 N Interrupting Calculations 5, Y5 Q, G% B/ Q; f3 O; j2 S1 @ MATLAB Windows 6 Ending a Session 7- T0 R3 o* Q! h- Y; y 2 MATLAB Basics 89 d# d* ~* U+ O0 {2 s Input and Output 85 E' s5 r6 _# t* S: b: k Arithmetic 8 Algebra 10* l6 E* x! ^9 Y Symbolic Expressions, Variable Precision, and Exact" |* g; o* L0 ?2 x4 f Arithmetic 11 Managing Variables 13 Errors in Input 14 Online Help 15 Variables and Assignments 16 Solving Equations 174 C, s8 Q5 g& A3 O Vectors and Matrices 20 Vectors 215 w2 ?1 M) v- `# J! j4 m; d Matrices 23* s% x  }+ d9 ~; }; M Suppressing Output 24 Functions 24" w1 \6 a/ T7 @  {+ l, D vii& N7 r- c* |6 Y0 X" v# R/ I viii Contents& T# `+ _' ^. ?, {9 }! [- S3 d Built-in Functions 24 User-Defined Functions 25* M. ?. Q\$ ~2 Q" H& K Graphics 264 \( L& f\$ b' I Graphing with ezplot 26' a- D% a4 }! N9 A# j9 k( S Modifying Graphs 27+ }" }; k. ]- D  c4 j: ~ Graphing with plot 28 Plotting Multiple Curves 308 x! I( M( z% P0 j8 j 3 Interacting with MATLAB 314 _0 V4 J5 h% p8 o/ S The MATLAB Interface 31 The Desktop 31 Menu and Tool Bars 33! \8 Z4 Z# L9 @( y4 k8 `7 ` The Workspace 33 The Working Directory 34 Using the Command Window 35 M-Files 36 Script M-Files 37  H% z, R; ]% o5 M7 f. Y! L Function M-Files 398 g/ F0 d/ k) c2 t7 w* d3 H; H. @ Loops 411 a\$ s; B9 I, [  v Presenting Your Results 41\$ j3 w2 d  b% y* M; X& O\$ Q( ~4 U Diary Files 42: ^' t' Q/ G; K1 n1 B Presenting Graphics 43 Pretty Printing 45\$ x/ U0 a+ ?& y8 u: v/ s A General Procedure 45 Fine-Tuning Your M-Files 46 Practice Set A: Algebra and Arithmetic 48 4 Beyond the Basics 50# @6 v1 h( Z1 ?3 J# N Suppressing Output 50 Data Classes 515 `4 b/ S  z/ S' ^9 T5 X String Manipulation 53 Symbolic and Floating Point Numbers 53 Functions and Expressions 54: t/ d' ~: [; {8 G\$ e( n% i5 G- u8 @ Substitution 56 More about M-Files 56 Variables in Script M-Files 56! R8 S+ ]2 F% U3 c( a Variables in Function M-Files 57 Structure of Function M-Files 57) |7 r- R/ W) p8 Q- f Contents ix5 y& Z3 r+ ^7 W( k3 _) x* t Complex Arithmetic 58! e1 l+ Z0 [" N+ F  g5 h9 E: O More on Matrices 59 Solving Linear Systems 60. w! c  E0 f1 j Calculating Eigenvalues and Eigenvectors 60 Doing Calculus withMA TLAB 61 Differentiation 61 Integration 62 Limits 63 Sums and Products 649 s+ H" {4 Y0 o! }: C Taylor Series 65 Default Variables 65 5 MATLAB Graphics 67 Two-Dimensional Plots 67& {+ U  H* g% C# D6 k Parametric Plots 67\$ V6 k, i- m5 J2 {% L3 q7 K Contour Plots and Implicit Plots 69% z6 i1 ?& Y; j  s8 }( q\$ f- ~1 ~ Field Plots 717 g2 K& \) B1 J Three-Dimensional Plots 72' v4 }5 g& ~. F* _6 H% c  ` Curves in Three-Dimensional Space 72 Surfaces in Three-Dimensional Space 73. L0 G1 d9 r; l+ K  E9 V Special Effects 75; C& N; n, _1 ?; ^# u9 L: ~ Combining Figures in One Window 76 Animations 778 G2 H7 o  @  ?: P" F) c. e Customizing and Manipulating Graphics 78 Change of Viewpoint 80 Change of Plot Style 80 Full-Fledged Customization 824 l+ {& m6 [' ~. L) R\$ i\$ |/ b( M Quick Plot Editing in the Figure Window 84; a; t! T1 S- E8 b. I% z Sound 85! o' R. P' m: R' @& Z: z  y) h Practice Set B: Calculus, Graphics, and Linear Algebra 86# S7 x( I3 |6 t9 M- A5 b% L4 M4 h. {/ t 6 M-Books 91 Enabling M-Books 92 Starting M-Books 934 |# d! ?- i% L9 u; G Working withM-Books 95, r\$ ?9 v2 ], } Editing Input 95. Q3 |9 C: [: W. d; n  Z7 \ The Notebook Menu 96) c0 H* L  ^" j: A* f4 d; i x Contents M-Book Graphics 97 More Hints for Effective Use of M-Books 98+ L" R. G, S) T- \\$ D0 {\$ | A Warning 998 d6 L/ Y+ Y. y% U: c 7 MATLAB Programming 101( B) O! G7 L\$ U9 V\$ D' w! \; L Branching 101 Branching with if 102" g# G& R9 @" {! ~ Logical Expressions 104  o# b% Z2 C% U& R" z" Y: M" Q Branching with switch 108 More about Loops 109; x6 D, i9 G  w: Y! c" J Open-Ended Loops 110& q  R6 y% a# B( j+ G/ z! s Breaking from a Loop 111 Other Programming Commands 112 Subfunctions 112 Commands for Parsing Input and Output 112 User Input and Screen Output 114 Evaluation 116" Q8 L; u8 t) s0 E7 U4 j) K Debugging 117) i4 ^' c. U: ~\$ R Interacting withth e Operating System 118 Calling External Programs 1187 \  N2 `: W' Z! j\$ x# E7 ? File Input and Output 1190 q8 d\$ F+ L6 [# c. u 8 SIMULINK and GUIs 121" V* _) P/ u. k( ~) Z/ o SIMULINK 1214 H6 d/ B3 R2 J Graphical User Interfaces (GUIs) 127 GUI Layout and GUIDE 127 Saving and Running a GUI 1300 p* K- [6 ^% h; D/ b. _2 ^ GUI Callback Functions 1329 G9 j2 s% g: l: k\$ F% I 9 Applications 136& q* ?1 B  a% \& ~8 e. @ Illuminating a Room 137 One 300-Watt Bulb 137 Two 150-Watt Bulbs 138- @  U: `) n% I2 C# k/ V4 G Three 100-Watt Bulbs 143 Mortgage Payments 145 Monte Carlo Simulation 149 Population Dynamics 1562 I. @. d) I! B, |5 o  u Exponential Growthand Decay 157 Contents xi/ T! ^3 o' X2 B" O\$ ?5 A LogisticGrowth159 Rerunning the Model with SIMULINK 166% n( b( ?0 f. {  o! P) @) M0 u Linear Economic Models 168: O  {  J, N2 i+ b' u: @4 \ Linear Programming 173! p5 G2 x' r# p) j7 Q" p( S The 360? Pendulum 1800 z, ?6 ^# Y, a9 c Numerical Solution of the Heat Equation 184 A Finite Difference Solution 185 The Case of Variable Conductivity 1890 ~& q& F( L9 R/ m& ] A SIMULINK Solution 191 Solution with pdepe 194& x. P# b9 I6 e2 h) M, I8 G A Model of Traffic Flow 196 Practice Set C: Developing Your MATLAB Skills 2044 T: O/ h  L7 d! W% ?" E  G6 a3 ^: f 10 MATLAB and the Internet 214% C! E+ O\$ S* g5 z MATLAB Help on the Internet 214 Posting MATLAB Programs and Output 215 M-Files, M-Books, Reports, and HTML Files 215 Configuring Your Web Browser 2165 O+ u: W8 F, s. o1 X- r7 p/ y Microsoft Internet Explorer 2169 H6 B+ I8 }/ x: i6 ^ Netscape Navigator 2165 X; c% z6 B\$ C 11 Troubleshooting 218 Common Problems 218 Wrong or Unexpected Output 218 Syntax Error 220% b. O- r; D0 P9 d5 G, }% U) z Spelling Error 2237 u4 c  X( ~/ ]7 k' {6 l( E) T4 ?( K Error Messages When Plotting 223, }. C1 ^% D\$ w7 ]/ r+ C; [# ^+ s: q A Previously Saved M-File Evaluates Differently 224 Computer Won’t Respond 2264 `0 @' ?# O) l% ]+ J2 `0 ]5 ^ The Most Common Mistakes 2265 M# d% T' g- f9 Q1 M Debugging Techniques 227\$ S0 ?, H, E1 u( a" J Solutions to the Practice Sets 235 Practice Set A 235* w- h0 h5 `& k! M! T Practice Set B 246 Practice Set C 266% L  J% f- ~. [0 G+ `5 I xii Contents/ Z1 u% f' v0 d/ z6 h" \ Glossary 299 MATLAB Operators 300 Built-in Constants 301 Built-in Functions 302 MATLAB Commands 303; b9 K" S2 }6 O; x' L( M Graphics Commands 309 MATLAB Programming 313 Index 317 indicates an advanced chapter or section that can be skipped on a first reading. Preface: E7 x4 }0 ~% U) j/ W That statement encapsulates the view of The MathWorks, Inc., the developer of MATLAB . MATLAB 6 is an ambitious program. It contains hundreds of commands to do mathematics. You can use it to graph functions, solve equations, perform statistical tests, and do much more. It is a high-level programming language that can communicate with its cousins, e.g., FORTRAN and C. You can produce sound and animate graphics. You can do simulations and modeling6 \* u; R/ a: w. i. _1 M* {" z (especially if you have access not just to basic MATLAB but also to its accessory SIMULINK ). You can prepare materials for export to the World Wide Web. In addition, you can use MATLAB, in conjunction withth e word processing and desktop publishing features of Microsoft Word , to combine0 a1 C; L) k4 L mathematical computations with text and graphics to produce a polished, integrated,% s4 h' ^2 `* L* e& j! A1 q3 t and interactive document." k" q( V1 s% R, } A program this sophisticated contains many features and options. There are literally hundreds of useful commands at your disposal. The MATLAB) z5 K; i0 K; `0 ?4 I, ^# v& q help documentation contains thousands of entries. The standard references,) B" b* t4 w0 \% p. n whether the MathWorks User’s Guide for the product, or any of our competitors, contain myriad tables describing an endless stream of commands,( |: Q7 q, R- n options, and features that the user might be expected to learn or access. MATLAB is more than a fancy calculator; it is an extremely useful and& z# _9 J; a7 S7 b# p versatile tool. Even if you only know a little about MATLAB, you can use it' k9 m( q6 Q, s' l# y to accomplish wonderful things. The hard part, however, is figuring out which of the hundreds of commands, scores of help pages, and thousands of items of: D: H: \9 ^3 a! {! L) j. [& X documentation you need to look at to start using it quickly and effectively. That’s where we come in. xiii xiv Preface; V% l8 s7 c+ F* @8 _ Why We Wrote This Book The goal of this book is to get you started using MATLAB successfully and, i\$ a& J6 H" @7 }% t quickly. We point out the parts of MATLAB you need to know without overwhelming you with details. We help you avoid the rough spots. We give you examples of real uses of MATLAB that you can refer to when you’re doing' M2 h' C" Z" `' l- G your own work. And we provide a handy reference to the most useful features of MATLAB. When you’re finished reading this book, you will be able to use MATLAB effectively. You’ll also be ready to explore more of MATLAB on your2 ]% H9 C0 [4 A9 _& b+ d own. You might not be a MATLAB expert when you finish this book, but you- W* S\$ Z' x1 G4 R9 h: s+ I" p will be prepared to become one — if that’s what you want. We figure you’re; z( A& Y3 T+ Y\$ d probably more interested in being an expert at your own specialty, whether. y3 ^. Y+ K  d\$ u7 c2 a that’s finance, physics, psychology, or engineering. You want to use MATLAB( \* P" T3 ~5 i5 o3 V the way we do, as a tool. This book is designed to help you become a proficient MATLAB user as quickly as possible, so you can get on withth e business at hand.; T. F# D6 S2 v. J/ Q Who Should Read This Book This book will be useful to complete novices, occasional users who want to/ P' U! P4 U8 A sharpen their skills, intermediate or experienced users who want to learn about the new features of MATLAB 6 or who want to learn how to use SIMULINK, and even experts who want to find out whether we know anything they don’t.' E9 v  Q/ L3 h* R" P+ f You can read through this guide to learn MATLAB on your own. If your employer (or your professor) has plopped you in front of a computer with MATLAB and told you to learn how to use it, then you’ll find the book particularly useful. If you are teaching or taking a course in which you want to. E0 K+ l* O3 f6 e/ y2 a+ o use MATLAB as a tool to explore another subject — whether in mathematics,5 v* a8 h* x; K. x  M science, engineering, business, or statistics — this book will make a perfect, C2 C( g  y\$ @0 ?2 V4 |# M% t6 q- O supplement. As mentioned, we wrote this guide for use with MATLAB 6. If you plan1 g1 P. n3 Y. ^( p! Y\$ I to continue using MATLAB 5, however, you can still profit from this book. Virtually all of the material on MATLAB commands in this book applies to bothversions . Only a small amount of material on the MATLAB interface, found mainly in Chapters 1, 3, and 8, is exclusive to MATLAB 6. Preface xv How This Book Is Organized In writing, we drew on our experience to provide important information as quickly as possible. The book contains a short, focused introduction to MATLAB. It contains practice problems (withcomplete solutions) so you can test your knowledge. There are several illuminating sample projects that show" }5 E! K. N2 Z2 [( K/ c you how MATLAB can be used in real-world applications, and there is an entire chapter on troubleshooting. The core of this book consists of about 75 pages: Chapters 1–4 and the beginning of Chapter 5. Read that much and you’ll have a good grasp of the fundamentals of MATLAB. Read the rest — the remainder of the Graphics chapter2 D7 d( ~  W. a9 O( R7 @+ s as well as the chapters on M-Books, Programming, SIMULINK and GUIs, Applications, MATLAB and the Internet, Troubleshooting, and the Glossary — and you’ll know enoughto do a great deal withMA TLAB. Here is a detailed summary of the contents of the book.# I3 f7 \3 s4 b7 ]. Z+ h Chapter 1, Getting Started, describes how to start MATLAB on different platforms. It tells you how to enter commands, how to access online help, how; L\$ `  J2 w2 G: [. E9 j to recognize the various MATLAB windows you will encounter, and how to) ~\$ ^; X7 X" A" G. P! \ exit the application.4 S\$ o# L0 r! R0 `6 e9 x" B. x Chapter 2, MATLABB asics, shows you how to do elementary mathematics using MATLAB. This chapter contains the most essential MATLAB2 e\$ {) l# ], ]( `# B: l commands.4 i6 K% I5 O1 y+ F# P% m Chapter 3, Interacting with MATLAB, contains an introduction to the MATLAB Desktop interface. This chapter will introduce you to the basic1 Z( b0 ^! O/ Q: G; g! z\$ D window features of the application, to the small program files (M-files) that you* C+ `, k* L\$ [ will use to make most effective use of the software, and to a simple method; R  Y& Q+ t8 I (diary files) of documenting your MATLAB sessions. After completing this chapter, you’ll have a better appreciation of the breadth described in the quote that opens this preface. Practice Set A, Algebra and Arithmetic, contains some simple problems for7 ~  v. q! R8 |+ c4 |# ]- l1 j practicing your newly acquired MATLAB skills. Solutions are presented at the end of the book.) M: R" B! @4 L6 x& v# l Chapter 4, Beyond the Basics, contains an explanation of the finer points that are essential for using MATLAB effectively. Chapter 5, MATLABGraphics , contains a more detailed look at many of( M2 i4 E- k" C; ~* x the MATLAB commands for producing graphics.7 v. {: C9 i# {% e, d Practice Set B, Calculus, Graphics, and Linear Algebra, gives you another2 C6 {. Q  A0 Q/ \ chance to practice what you’ve just learned. As before, solutions are provided at the end of the book. xvi Preface3 @0 N! G7 e6 n- ?* y2 e Chapter 6, M-Books, contains an introduction to the word processing and- S7 Z+ m% Z5 m* J0 f9 @ desktop publishing features available when you combine MATLAB with; q4 z# w! l/ v Microsoft Word. Chapter 7, MATLABProgramming , introduces you to the programming features of MATLAB. This chapter is designed to be useful both to the novice4 F& s2 r, p, s( z. Q9 S programmer and to the experienced FORTRAN or C programmer., ]8 r3 ?" U+ h5 I0 Q Chapter 8, SIMULINK and GUIs, consists of two parts. The first part describes the MATLAB companion software SIMULINK, a graphically oriented8 @2 r* l2 s' T, ?2 V+ t* Y( v! k package for modeling, simulating, and analyzing dynamical systems. Many9 [% f% X! U; p& \ of the calculations that can be done with MATLAB can be done equally well with SIMULINK. If you don’t have access to SIMULINK, skip this part of& O( _4 ]" ]5 f: `) \8 `7 Z& Q! E Chapter 8. The second part contains an introduction to the construction and deployment of graphical user interfaces, that is, GUIs, using MATLAB. Chapter 9, Applications, contains examples, from many different fields, of3 b8 ?# Z, v0 x0 ^\$ F& o) \/ n6 d3 @ solutions of real-world problems using MATLAB and/or SIMULINK.! j\$ [/ H- N' U- C, j2 J/ N' f4 i Practice Set C, Developing YourMATLABSkills , contains practice problems whose solutions use the methods and techniques you learned in Chapters 6–9. Chapter 10, MATLABand the Internet, gives tips on how to post MATLAB output on the Web.' C9 W. u4 p: Z1 {' D Chapter 11, Troubleshooting, is the place to turn when anything goes wrong. Many common problems can be resolved by reading2 c9 h: d0 o5 p9 f! ]* F % W9 Y- x2 k0 b) O5 _ 8 T6 u6 ?2 x' V9 V7 F! E- R l伶小 9 a& g% ?2 ]\$ n+ R) @) h5 @6 ^* ] 2 p4 V, _  G5 J% H0 k! P 联系QQ：526781618 2 T( A, z- F* G4 G 淘宝旺旺：跟朝流走# y& U+ g1 m7 W1 j7 X, z0 s\$ d 有需要的欢迎联系！专业代购电子书, z# A& k% x; i9 d # K' t# X7 Z+ l; l5 ?2 ~& w9 r0 _; g# M, @ 6 l0 S9 ^# X8 y- C ebook 英文电子书代购