اسم المؤلف
التاريخ
4 سبتمبر 2017
المشاهدات
845
التقييم

سلسلة مايجب على كل مهندس معرفته عن الماتلاب والسميولينك
With contributions by Moshe Breiner
Contents
Preface xv
I Introducing MATLAB 1
1 Introduction to MATLAB 3
1.1 Starting MATLAB 3
1.2 Using MATLAB as a simple calculator . 5
1.3 How to quit MATLAB 9
1.4 Using MATLAB as a scientific calculator 10
1.4.1 Trigonometric functions . 10
1.4.2 Inverse trigonometric functions . 13
1.4.3 Other elementary functions . 15
1.5 Arrays of numbers 16
1.6 Using MATLAB for plotting . 18
1.6.1 Annotating a graph . 20
1.7 Format . 21
1.8 Arrays of numbers 22
1.8.1 Array elements 22
1.8.2 Plotting resolution 23
1.8.3 Array operations . 24
1.9 Writing simple functions in MATLAB . 27
1.10 Summary . 31
1.11 Examples . 34
1.12 More exercises . 42
2 Vectors and matrices 47
2.1 Vectors in geometry . 48
2.1.1 Arrays of point coordinates in the plane 48
2.1.2 The perimeter of a polygon – for loops . 52
2.1.3 Vectorization . 55
2.1.4 Arrays of point coordinates in solid geometry . 56
2.1.5 Geometrical interpretation of vectors 61
2.1.6 Operating with vectors 63
2.1.7 Vector basis 65
2.1.8 The scalar product 66
2.2 Vectors in mechanics . 69
2.2.1 Forces. The resultant of two or more forces 69
2.2.2 Work as a scalar product 72
2.2.3 Velocities. Composition of velocities 72
2.3 Matrices 73
2.3.1 Introduction – the matrix product . 73
2.3.2 Determinants . 77
2.4 Matrices in geometry . 78
2.4.1 The vector product. Parallelogram area 78
2.4.2 The scalar triple product. Parallelepiped volume . 80
2.5 Transformations 82
2.5.1 Translation — Matrix addition and subtraction 82
2.5.2 Rotation 83
2.5.3 Homogeneous coordinates 84
2.6 Matrices in Mechanics 88
2.6.1 Angular velocity . 88
2.6.2 Center of mass 89
2.6.3 Moments as vector products . 91
2.7 Summary . 93
2.8 More exercises . 98
3 Equations 103
3.1 Introduction 103
3.2 Linear equations in geometry 103
3.2.1 The intersection of two lines . 103
3.2.2 Cramer’s rule . 104
3.2.3 MATLAB’s solution of linear equations 105
3.2.4 An example of an ill-conditioned system 107
3.2.5 The intersection of three planes . 109
3.3 Linear equations in statics 109
3.3.1 A simple beam 109
3.4 Linear equations in electricity 112
3.4.1 A DC circuit . 112
3.4.2 The method of loop currents 114
3.5 On the solution of linear equations . 116
3.5.1 Homogeneous linear equations 116
3.5.2 Overdetermined systems — least-squares solution . 119
3.5.3 Underdetermined system . 123
3.5.4 A singular system . 126
3.5.5 Another singular system . 128
3.6 Summary 1 132
3.7 More exercises . 134
3.8 Polynomial equations . 135
3.8.1 MATLAB representation of polynomials 135
3.8.2 The MATLAB root function 135
3.9 Iterative solution of equations 143
3.9.1 The Newton-Raphson method 143
3.9.2 Solving an equation with the command fzero . 147
3.10 Summary 2 148
3.11 More exercises . 149
4 Processing and publishing the results 151
4.1 Copy and paste 151
4.2 Diary 152
4.3 Exporting and processing figures 152
4.4 Interpolation . 153
4.4.1 Interactive plotting and curve fitting 153
4.5 The MATLABspline function . 157
4.6 Importing data from Excel – histograms . 165
4.7 Summary . 167
4.8 Exercises 169
II Programming in MATLAB 171
5 Some facts about numerical computing 173
5.1 Introduction 173
5.2 Computer-aided mistakes 174
5.2.1 A loop that does not stop 175
5.2.2 Errors in trigonometric functions 176
5.2.3 An unexpected root . 176
5.2.4 Other unexpected roots . 178
5.2.5 Accumulating errors . 179
5.3 Computer representation of numbers 180
5.4 The set of computer numbers 184
5.5 Roundoff 186
5.6 Roundoff errors 187
5.7 Computer arithmetic . 191
5.8 Why the examples in Section 5.2 failed . 193
5.8.1 Absorbtion 193
5.8.2 Correcting a non-terminating loop . 194
5.8.3 Second-degree equation . 194
5.8.4 Unexpected polynomial roots 196
5.9 Truncation error . 199
5.10 Complexity 202
5.10.1 Definition, examples . 202
5.11 Horner’s scheme 205
5.12 Problems that cannot be solved . 206
5.13 Summary . 208
5.14 More examples 209
5.15 More exercises . 211xii What every engineer should know about MATLABand Simulink
6 Data types and object-oriented programming 215
6.1 Structures . 216
6.1.1 Where structures can help 216
6.1.2 Working with structures . 217
6.2 Cell arrays . 219
6.3 Classes and object-oriented programming . 221
6.3.1 What is object-oriented programming? . 221
6.3.2 Calculations with units 222
6.3.3 Defining a class 224
6.3.4 Defining a subclass 229
6.3.5 Calculating with electrical units . 233
6.4 Summary . 238
6.5 Exercises 240
III Progressing in MATLAB 243
7 Complex numbers 245
7.1 The introduction of complex numbers . 245
7.2 Complex numbers in MATLAB . 245
7.3 Geometric representation 248
7.4 Trigonometric representation 250
7.5 Exponential representation . 250
7.6 Functions of complex variables . 253
7.7 Conformal mapping . 255
7.8 Phasors 259
7.8.1 Phasors 259
7.8.2 Phasors in mechanics . 261
7.8.3 Phasors in electricity . 265
7.9 An application in mechanical engineering — a mechanism 271
7.9.2 Displacement analysis of the four-link mechanism . 272
7.9.3 A MATLAB function that simulates the motion of the
7.9.4 Animation . 277
7.9.5 A variant of the function FourLink . 278
7.10 Summary . 281
7.11 Exercises 283
8 Numerical integration 287
8.1 Introduction 287
8.2 The trapezoidal rule . 288
8.2.1 The formula 288
8.2.2 The MATLAB trapz function . 289
8.3 Simpson’s rule . 290
8.3.2 A function that implements Simpson’s rule 292
8.4 The MATLAB quadl function 293
8.5 Symbolic calculation of integrals 295
8.6 Summary . 297
8.7 Exercises 298
9 Ordinary differential equations 301
9.1 Introduction 301
9.2 Numerical solution of ordinary differential equations . 301
9.2.1 Cauchy form . 301
9.3 Numerical solution of ordinary differential equations . 302
9.3.1 Specifying the times of the solution . 305
9.3.2 Using alternative odesolvers . 306
9.3.3 Passing parameters to the model 306
9.4 Alternative strategies to solve ordinary differential equations . 310
9.4.1 Runge–Kutta methods 312
9.4.2 Predictor-corrector methods . 315
9.4.3 Stiff systems 316
9.5 Conclusion: How to choose the odesolver 323
9.6 Exercises 324
10 More graphics 327
10.1 Introduction 327
10.2 Drawing at scale . 327
10.3 The cone surface and conic sections . 330
10.3.1 The cone surface . 330
10.3.2 Conic sections . 332
10.3.3 Developing the cone surface . 336
10.3.4 A helicoidal curve on the cone surface . 337
10.3.5 The listing of functions developed in this section . 338
10.4 GUIs – graphical user interfaces . 343
10.5 Summary . 355
10.6 Exercises 356
11 An introduction to Simulink 359
11.1 What is simulation? . 359
11.2 Beats 360
11.3 A model of the momentum law . 366
11.4 Capacitor discharge 370
11.5 A mass–spring–dashpot system . 376
11.6 A series RLC circuit . 380
11.7 The pendulum 383
11.7.1 The mathematical and the physical pendulum . 383
11.7.2 The phase plane . 387
11.7.3 Running the simulation from a script file 39111.8 Exercises 393
12 Applications in the frequency domain 395
12.1 Introduction 395
12.2 Signals . 395
12.3 A short introduction to the DFT 398
12.4 The power spectrum . 400
12.5 Trigonometric expansion of a signal . 407
12.6 High frequency signals and aliasing . 410
12.7 Bode plot . 412
12.8 Summary . 414
12.9 Exercises 415