《MATLAB编程(第4版)》是2011年科学出版社出版的图书,作者是StephenJ.Chapman。
《matlab编程(第4版)》详细讲述了利用matlab解决典型技术问题的方法,包括自顶向下的程序设计方法、函数的使用、matlab内部工具的使用和数据结构、使用技巧和常见错误等。作者将matlab作为一种科技程序设计语言进行介绍,帮助读者编写出简洁、高效、组织良好的程序;同时,帮助读者使用matlab的扩展在线帮助功能来找到所需的函数。《matlab编程(第4版)》注重提高读者利用matlab解决实际问题的能力,为将来的学习与研究工作打下良好的基础。
《matlab编程(第4版)》可作为工科各专业本科生的教学用书,也可作为工程技术人员的参考书。
目录
- 《matlab编程(第4版)》
- chapter 1 introduction to matlab
- 1.1 the advantages of matlab 1
- 1.2 disadvantages of matlab 3
- 1.3 the matlab environment 3
- 1.3.1 the matlab desktop 4
- 1.3.2 the command window 5
- 1.3.3 the command history window
- 1.3.4 the start button 6
- 1.3.5 the edit/debug window 7
- 1.3.6 figure windows 8
- 1.3.7 docking and undocking windows 9
- 1.3.8 the matlab workspace 10
- 1.3.9 the workspace browser 10
- 1.3.10 getting help 11
- 1.3.11 a few important commands 13
- 1.3.12 the matlab search path 14
- 1.4 using matlab as a scratch pad 15
- 1.5 summary 17
- 1.5.1 matlab summary 17
- .1.6 exercises 17
- chapter 2 matlab basics 19
- 2.1 variables and arrays 19
- 2.2 creating and initializing variables in matlab 22
- 2.2.1 initializing variables in assignment statements 22
- 2.2.2 initializing with shortcut expressions 25
- 2.2.3 initializing with built-in functions 26
- 2.2.4 initializing variables with keyboard input 26
- 2.3 multidimensional arrays 28
- 2.3.1 storing multidimensional arrays in memory 29
- 2.3.2 accessing multidimensional arrays with one dimension 30
- 2.4 subarrays 30
- 2.4.1 the end function 31
- 2.4.2 using subarrays on the left-hand side of an assignment statement 31
- 2.4.3 assigning a scalar to a subarray 32
- 2.5 special values 33
- 2.6.1 changing the default format 35
- 2.6.2 the disp function 36
- 2.6.3 formatted output with the fprintf function 36
- 2.7 data files 38
- 2.8 scalar and array operations 41
- 2.8.1 scalar operations 41
- 2.8.2 array and matrix operations 41
- 2.9 hierarchy of operations 44
- 2.10 built-in matlab functions 47
- 2.10.1 optional results 47
- 2.10.2 using matlab functions with array inputs 47
- 2.10.3 common matlab functions 47
- 2.11 introduction to plotting 48
- 2.11.1 using simple xy plots 49
- 2.11.2 printing a plot 50
- 2.11.3 exporting a plot as a graphical image 50
- 2.11.4 multiple plots 51
- 2.11.5 line color, line style, marker style, and lc. gends 52
- 2.11.6 logarithmic scales 55
- 2.12 examples 56
- 2.13 debugging matlab programs 62
- 2.14 summary 64
- 2.14.1 summary of good programming practice 64
- 2.14.2 matlab summary 65
- 2.15 exercises 67
- chapter 3 branching statements and program design
- 3.1 introduction to top-down design techniques 74
- 3.2 use of pseudocode 79
- 3.3 the logical data type 80
- 3.3.1 relational operators 80
- 3.3.2 a caution about the = and ~= operators 82
- 3.3.3 logic operators 83
- 3.3.4 logical functions 87
- 3.4 branches 89
- 3.4:1 the if construct 89
- 3.4.2 examples using if constructs 91
- 3.4.3 notes concerning the use of if constructs 96
- 3.4.4 the switch construct 98
- 3.4.5 the try/catch construct 99
- 3.5 additional plotfi'ng features 101
- 3.5.1 controlling x-and y-axis plotting limits 101
- 3.5.2 plotting multiple plots on the same axes 103
- 3.5.4 subplots 104
- 3.5.5 enhanced control of plotted lines 106
- 3.5.6 enhanced control of text strings 106
- 3.5.7 polar plots 108
- 3.5.8 annotating and saving plots 113
- 3.6 more on debugging matlab programs 116
- 3.7 summary 119
- 3.7.1 summary of good programming practice 120
- 3.7.2 matlab summary 120
- 3.8 exercises 121
- chapter 4 loops 126
- 4.1 the while loop 126
- 4.2 the for loop 131
- 4.2.1 details of operation 137
- 4.2.2 the matlab just-in-time (jit) compiler 139
- 4.2.3 the break and continue statements 143
- 4.2.4 nesting loops 145
- 4.3 logical arrays and vectorization 146
- 4.3.1 creating the equivalent of if / else constructs with logical arrays 147
- 4.4 the matlab profiler 149
- 4.5 additional examples 151
- 4.6 summary 163
- 4.6.1 summary of good programming practice 164
- 4.6.2 matlab summary 164
- 4.7 exercises 164
- chapter 5 user-defined functions 172
- 5.1 introduction to matlab functions 173
- 5.2 variable passing in matlab: the pass-by-value scheme 177
- 5.3 optional arguments 187
- 5.4 sharing data using global memory 192
- 5.5 preserving data between calls to a function 198
- 5.6 function functions 203
- 5.7 subfunctions, private functions, and nested functions 206
- 5.7.1 subfunctions 207
- 5.7.2 private functions 208
- 5.7.3 nested functions 209
- 5.7.4 order of function evaluation 211
- 5.8 summary 211
- 5.8.1 summary of good programming practice 212
- 5.8.2 matlab summary 212
- 5.9 exercises 213
- chapter 6 additional data ypes and plot types 225
- 6.1 complex data 226
- 6.1.1 complex variables 227
- 6.1.2 using complex numbers with relational operators 227
- 6.1.3 complex functions 228
- 6.1.4 plotting complex data 231
- 6.2 string functions 234
- 6.2.1 string conversion functions 234
- 6.2.2 creating two-dimensional character arrays 234
- 6.2.3 concatenating sizings 235
- 6.2.4 comparing strings 235
- 6.2.5 searching and replacing characters within a string 239
- 6.2.6 uppercase and lowercase conversion 240
- 6.2.7 trimming whitespace from strings 240
- 6.2.8 numeric-to-string conversions 241
- 6.2.9 string-to-numeric conversions 242
- 6.2.10 summary 243
- 6.3 multidimensional arrays 248
- 6.4 additional data types 250
- 6.4.1 the single data type 250
- 6.4.2 integer data types 251
- 6.4.3 limitations of the s lng 1 e and integer data types 253
- 6.5 additional two-dimensional plots 253
- 6.5.1 additional types of two-dimensional plots 253
- 6.5.2 plotting functions 256
- 6.5.3 histograms 257
- 6.6 three-dimensional plots 258
- 6.6.1 three-dimensional line plots 258
- 6.6.2 three-dimensional surface, mesh, and contour plots 260
- 6.7 summary 262
- 6.7.1 summary of good programming practice 263
- 6.7.2 matlab summary 263
- 6.8 exercises 264
- chapter 7 advanced features: sparse arrays, cell arrays,structures, and function handles 268
- 7.1 sparse arrays 268
- 7.1.1 the sparse attribute 270
- 7.2 cell arrays 274
- 7.2.1 creating cell arrays 276
- 7.2.2 using braces { } as cell constructors 277
- 7.2.3 viewing the contents of cell arrays 277
- 7.2.4 extending cell arrays 278
- 7.2.5 deleting cells in arrays 280
- 7.2.6 using data in cell arrays 280
- 7.2.7 cell arrays of strings 281
- 7.2.8 the significance of cell arrays 282
- 7.2.9 summary,of cel 1 functions 285
- 7.3 structure arrays 285
- 7.3.1 creating structure arrays 286
- 7.3.2 adding fields to structures 288
- 7.3.3 removing fields from structures 289
- 7.3.4 using data in structure arrays 289
- 7.3.5 the getfield and setfield functions 290
- 7.3.6 dynamic field names 291
- 7.3.7 using the size function with structure arrays 293
- 7.3.8 nesting structure arrays 292
- 7.3.9 summary of structure functions 293
- 7.4 function handles 293
- 7.4.1 creating and using function handles 293
- 7.4.2 the significance of function handles 296
- 7.4.3 function handles and nested functions 297
- 7.4.4 an example application: solving ordinary differential equations 298
- 7.5 summary 305
- 7.5.1 summary of good programming practice 305
- 7.5.2 matlab summary 305
- 7.6 exercises 306
- chapter 8 input/output functions
- 8.1 the textreadfunction 311
- 8.2 more about the load and save commands 312
- 8.3 an introduction to matlab file processing 315
- 8.4 file opening and closing 316
- 8.4.1 the fopen function 316
- 8.4.2 the fclose function 319
- 8.5 binary i/o functions 319
- 8.5.1 the fwrite function 319
- 8.5.2 the fread function 320
- 8.6 formatted uo functions 323
- 8.6.1 the fprintf function 323
- 8.6.2 understanding format conversion specifiers 325
- 8.6.3 how format strings are used 326
- 8.6.4 the sprint f function 328
- 8.6.5 the fscanf function 329
- 8.6.6 the fgetl function 331
- 8.6.7 the fgets function 331
- 8.7 comparing formatted and binary i/o functions 331
- 8.8 file positioning and status functions 336
- 8.8.1 the exist function 336
- 8.8.2 the ferror function 339
- 8.8.3 the feof function 339
- 8.8.4 the ftell function 339
- 8.8.5 the frewind function 339
- 8.8.6 the fseek function 339
- 8.9 the textscan function 345
- 8.10 function uiimport 347
- 8.11 summary 348
- 8.11.1 summary of good programming practice 349
- 8.11.2 matlab summary 350
- 8.12 exercises 350
- chapter 9 handle graphics 353
- 9.1 the matlab graphics system 353
- 9.2 object handles 354
- 9.3 examining and changing object properties 355
- 9.3.1 changing object properties at creation time 355
- 9.3.2 changing object properties after creation time 355
- 9.4 using set to list possible property values 361
- 9.5 user-defined data 362
- 9.6 finding objects 363
- 9.7 selecting objects with the mouse 365
- 9.8 position and units 367
- 9.8.1 positions of figure objects 367
- 9.8.2 positions of axes and uicontrol objects 368
- 9.8.3 positions of text objects 368
- 9.9 printer positions 371
- 9.10 default and factory properties 372
- 9.11 graphics object properties 373
- 9.12 summary 374
- 9.12.1 summary of good programming practice 374
- 9.12.2 matlab summary 375
- 9.13 exercises 375