Table of contents of _MATLAB Programming for Engineers_, by S J Chapman Assigned readings are marked by date. [1/23] 1 Introduction to MATLAB [1/23] 1.1 The Advantages of MATLAB 1 [1/23] 1.2 Disadvantages of MATLAB 3 [1/23] 1.3 The MATLAB Environment 3 [1/23] 1.3.1 The Command Window 4 [1/23] 1.3.2 The Edit Window 5 [1/23] 1.3.3 The Figure Window 5 [1/23] 1.3.4 The MATLAB Workspace 6 [1/23] 1.3.5 A Few Important Commands 8 [1/23] 1.3.6 Getting Help 9 [1/23] 1.3.7 The MATLAB Path 10 [1/23] 1.4 Using MATLAB as a Scratchpad 11 [1/23] 1.5 Summary 12 [1/23] 1.5.1 MATLAB Summary 13 [1/23] 1.6 Exercises 13 [2/01] 2 MATLAB Basics [2/01] 2.1 Variables and Arrays 15 [2/01] 2.2 Initializing Variables in MATLAB 18 [2/01] 2.2.1 Initializing Variables in Assignment Statements 19 [2/01] 2.2.2 Initializing with Shortcut Expressions 21 [2/01] 2.2.3 Initializing with Built-in Functions 22 [2/08] 2.2.4 Initializing Variables with Keyboard Input 23 [2/06] 2.3 Subarrays 25 [2/15] 2.4 Special Values 25 [2/08] 2.5 Displaying Output Data 27 [2/08] 2.5.1 Changing the Default Format 27 [2/08] 2.5.2 The disp Function 28 [2/08] 2.5.3 Formatted Output with the fprintf Function 28 [2/08] 2.6 Data Files 30 [2/01] 2.7 Scalar and Array Operations 32 [2/01] 2.7.1 Scalar Operations 33 [2/01] 2.7.2 Array and Matrix Operations 33 [2/01] 2.8 Hierarchy of Operations 36 [2/01] 2.9 Built-in MATLAB Functions 39 [2/01] 2.9.1 Optional Results 39 [2/01] 2.9.2 Using MATLAB Functions with Array Inputs 40 [2/01] 2.9.3 Common MATLAB Functions 40 [2/01] 2.10 Introduction to Plotting 40 [2/01] 2.10.1 Using Simple xy Plots 42 [2/01] 2.10.2 Printing a Plot 43 [2/01] 2.10.3 Multiple Plots 44 [2/01] 2.10.4 Line Color, Line Style, Marker Style, and Legends 44 [2/01] 2.10.5 Logarithmic Scales 46 [2/01] 2.11 Examples 47 [2/01] 2.12 Debugging MATLAB Programs 55 [2/01] 2.13 Summary 57 [2/01] 2.13.1 Summary of Good Programming Practice 57 [2/01] 2.13.2 MATLAB Summary 58 [2/01] 2.14 Exercises 61 [2/01] 3 Branching Statements and Program Design 67 [2/01] 3.1 Introduction to Top-Down Design Techniques 67 [2/01] 3.2 Use of Pseudocode 72 [2/01] 3.3 Relational and Logical Operators 73 [2/01] 3.3.1 Relational Operators 73 [2/01] 3.3.2 A Caution about the == and ~= Operators 75 [2/01] 3.3.3 Logic Operators 76 [2/01] 3.3.4 Logical Functions 78 [2/01] 3.4 Branches 79 [2/01] 3.4.1 The if Construct 79 [2/01] 3.4.2 Examples Using if Constructs 81 [2/01] 3.4.3 Notes Concerning the Use of if Constructs 87 [2/15] 3.4.4 The switch Construct 90 [2/15] 3.5 Additional Plotting Features 92 [2/15] 3.5.1 Controlling x- and y-axis Plotting Limits 92 [2/15] 3.5.2 Plotting Multiple Plots on the Same Axes 94 [2/15] 3.5.3 Creating Multiple Figures 94 [2/15] 3.5.4 Subplots 96 [2/15] 3.5.5 Enhanced Control of Plotted Lines 98 [2/15] 3.5.6 Enhanced Control of Text Strings 99 [2/15] 3.5.7 Polar Plots 99 [2/15] 3.6 More on Debugging MATLAB Programs 105 [2/15] 3.7 Summary 107 [2/15] 3.7.1 Summary of Good Programming Practice 109 [2/15] 3.7.2 MATLAB Summary 109 [2/15] 3.8 Exercises 110 4 Loops 115 [2/15] 4.1 The while Loop 115 [2/01] 4.2 The for Loop 121 [2/01] 4.2.1 Details of Operation 128 [2/01] 4.2.2 The break Statement 132 [2/01] 4.2.3 Nesting Loops 133 [2/15] 4.3 Additional Examples 135 [2/15] 4.4 Summary 150 [2/15] 4.4.1 Summary of Good Programming Practice 150 [2/15] 4.4.2 MATLAB Summary 150 [2/15] 4.5 Exercises 151 [2/08] 5 User-Defined Functions 159 [2/08] 5.1 Introduction to MATLAB Functions 161 [2/08] 5.2 Variable Passing in MATLAB: The Pass-By-Value Scheme 163 [2/15] 5.3 Optional Arguments 170 5.4 Sharing Data Using Global Memory 175 5.6 Preserving Data Between Calls to a Function 183 5.7 Subfunctions and Private Functions 191 5.8 Summary 193 5.8.1 Summary of Good Programming Practice 194 5.8.2 MATLAB Summary 195 5.9 Exercises 195 [2/15] 6 Complex Data, Character Data, and Additional Plot Types 207 [2/15] 6.1 Complex Data 207 [2/15] 6.1.1 Complex Variables 209 [2/15] 6.1.2 Using Complex Numbers with Relational Operators 210 [2/15] 6.1.3 Complex Functions 210 [2/15] 6.1.4 Plotting Complex Data 214 [2/15] 6.2 String Functions 218 [2/15] 6.2.1 String Conversion Functions 218 [2/15] 6.2.2 Creating Two-Dimensional Character Arrays 218 [2/15] 6.2.3 Concatenating Strings 219 [2/15] 6.2.4 Comparing Strings 220 [2/15] 6.2.5 Searching/Replacing Characters Within a String 222 [2/15] 6.2.6 Uppercase and Lowercase Conversion 223 [2/15] 6.2.7 Numeric-to-String Conversions 224 [2/15] 6.2.8 String-to_Numeric Conversions 225 [2/15] 6.2.9 Summary 226 6.3 Multidimensional Arrays 232 [3/13] 6.4 Additional Two-Dimensional Plots 234 [3/13] 6.4.1 Additional Types of Two-Dimensional Plots 234 [3/13] 6.4.2 Plotting Functions 239 [3/13] 6.4.3 Histograms 240 [3/13] 6.5 Three-Dimensionsl Plots 242 [3/13] 6.5.1 Three-Dimensional Line Plots 242 [3/13] 6.5.2 Three-Dimensional Surface, Mesh, and Contour Plots 244 [3/13] 6.6 Summary 247 [3/13] 6.6.1 Summary of Good Programming Practice 247 [3/13] 6.6.2 MATLAB Summary 248 [3/13] 6.7 Exercises 249 7 Sparse Arrays, Cell Arrays, and Structures 253 7.1 Sparse Arrays 253 7.1.1 The sparse Data Type 255 7.2 Cell Arrays 260 7.2.1 Creating Cell Arrays 262 7.2.2 Using Braces {} as Cell Constructors 263 7.2.3 Viewing the Contents of Cell Arrays 264 7.2.4 Extending Cell Arrays 264 7.2.5 Deleting Cells in Arrays 266 7.2.6 Using Data in Cell Arrays 266 7.2.7 Cell Arrays of Strings 267 7.2.8 The Significance of Cell Arrays 268 7.2.9 Summary of cell Array Functions 271 [2/15] 7.3 Structure Arrays 272 [2/15] 7.3.1 Creating Structures 272 [2/15] 7.3.2 Adding Fields to Structures 274 [2/15] 7.3.3 Removing Fields from Structures 275 [2/15] 7.3.4 Using Data in Structure Arrays 276 [2/15] 7.3.5 The getfield and setfield Functions 277 [2/15] 7.3.6 Using the size Function with Structure Arrays 278 [2/15] 7.3.7 Nesting Structure Arrays 278 [2/15] 7.3.8 Summary of structure Functions 279 7.4 Summary 280 7.4.1 Summary of Good Programming Practice 281 7.4.2 MATLAB Summary 281 7.5 Exercises 282 8 Input/Output Functions 285 8.1 The textread Function 285 8.2 More about the load and save Commands 287 8.3 An Introduction to MATLAB File Processing 289 8.4 File Opening and Closing 291 8.4.1 The fopen Function 291 8.4.2 The fclose Function 294 8.5 Binary I/O Functions 294 8.5.1 The fwrite Function 294 8.5.2 The fread Function 295 8.6 Formatted I/O Functions 298 8.6.1 The fprint Function 298 8.6.2 Understanding Format Conversion Specifiers 300 8.6.3 How Format Strings are Used 302 8.6.4 The fscanf Function 305 8.6.5 The fget1 Function 307 8.6.6 The fgets Function 307 8.7 Comparing Formatted and Binary I/O Functions 308 8.8 File Positioning and Status Functions 313 8.8.1 The exist Function 313 8.8.2 The ferror Function 315 8.8.3 The feof Function 316 8.8.4 The ftell Function 316 8.8.5 the frewind Function 316 8.8.6 The fseek Function 316 8.9 Summary 322 8.9.1 Summary of Good Programming Practice 323 8.9.2 MATLAB Summary 323 8.10 Exercises 324 9 Handle Graphics 327 9.1 The MATLAB Graphics System 327 9.2 Object Handles 329 9.3 Examining and Changing Object Properties 329 9.3.1 Changing Object Properties at Creation Time 329 9.3.2 Changing Object Properties after Creation Time 330 9.4 Using set to List Possible Property Values 335 9.5 Finding Objects 336 9.6 Selecting Objects with the Mouse 338 9.7 Position and Units 341 9.7.1 Positions of figure Objects 341 9.7.2 Positions of axes and uicontrol Objects 342 9.7.3 Positions of text Objects 342 9.8 Printer Positions 344 9.9 Default and Factory Properties 346 9.10 Graphics Object Properties 348 9.11 Summary 348 9.11.1 Summary of a Good Programming Practice 348 9.11.2 MATLAB Summary 349 9.12 Exercises 349 10 Graphical User Interfaces 351 10.1 How a Graphical User Interface Works 351 10.2 Creating and Displaying a Graphical User Interface 352 10.2.1 The Structure of a GUI 359 10.2.2 Modifying a GUI Manually 361 10.2.3 A Caution About Using guide 362 10.2.4 A Few Essential Functions 363 10.3 Object Properties 363 10.4 Graphical User Interface Components 364 10.4.1 Text Fields 366 10.4.2 Edit Boxes 366 10.4.3 Frames 366 10.4.4 Pushbuttons 368 10.4.5 Toggle Buttons 368 10.4.6 Check Boxes and Radio Buttons 370 10.4.7 Popup Menus 371 10.4.8 List Boxes 375 10.4.9 Sliders 378 10.5 Dialog Boxes 383 10.5.1 Error and Warning Dialog Boxes 385 10.5.2 Input Dialog Boxes 385 10.5.3 The uigetfile and uisetfile Dialog Boxes 386 10.6 Menus 388 10.6.1 Suppressing the Default Menu 390 10.6.2 Creating Your Own Menus 391 10.6.3 Accelerator Keys and Keyboard Mnemonics 392 10.6.4 Creating Context Menus 393 10.7 Tips for Creating Efficient GUIs 400 10.7.1 Tool Tips 400 10.7.2 Pcode 401 10.7.3 Additional Enhancements 402 10.8 Summary 411 10.8.1 Summary of Good Programming Practice 412 10.8.2 MATLAB Summary 412 10.9 Exercises 413 APPENDIX A ASCII Character Set 415 APPENDIX B Answers to Quizzes 417 Index 431