Table of Contents
Chapter 1 Introduction to Computers and Programming 1
1.1 Background 2
1.2 History of Computer Architectures 3
1.3 Computing Systems Today 5
1.4 Executing a MATLAB Program 13
1.5 Problem Solving 13
Chapter 2 Getting Start with MATLAB 17
2.1 Programming Language Background 19
2.2 Basic Data Manipulation 21
2.3 The MATLAB User interface 25
2.4 Scripts 35
2.5 Engineering Example- Spacecraft Launch 39
Chapter 3 Vectors and Arrays 47
3.1 Concept: Using Built-in Functions 48
3.2 Concept Data Collections 48
3.3 MATLAB Vectors 48
3.4 Engineering Example-Forces and Moments 61
3.5 MATLAB Arrays 62
3.6 Engineering Example- Computing Soil Volume 74
Chapter 4 Execution Control 85
4.1 Concept Code Blocks 86
4.2 Conditional Execution in General 86
4.3 if Statements 87
4.4 switch Statements 92
4.5 Iteration in General 94
4.6 for loops 95
4.7 while loops 98
4.8 Engineering Example-computing Liquid Levels 101
Chapter 5 Functions 111
5.1 Concepts: Abstraction and Encapsulation 112
5.2 Black Box View of a Function 112
5.3 MATLAB Implementation 113
5.4 Engineering Example-Measuring a Solid Object 119
Chapter 6 Character Strings 127
6.1 Character String Concepts; Mapping Casting, Tokens and Delimiting 128
6.2 MATLAB Implementation 129
6.3 Format Conversion Functions 131
6.4 Character String Operations 134
6.5 Arrays of Strings 137
6.6 Engineering Example-Encryption 138
Chapter 7 Cell Arrays and Structures 147
7.1 Concept Collecting Dissimilar Objects 148
7.2 Cell Arrays 148
7.3 MATLAB Structures 153
7.4 Structure Arrays 156
7.5 Engineering Example-Assembling a Structure 162
Chapter 8 File Input and Output173
8.1 Concept Serial Input and Output (I/O) 174
8.2 MATLAB Workspace I/O 174
8.3 High-Level File I/O Functions 175
8.4 Lower-Level File I/O 180
8.5 Engineering Example-Spreadsheet Data 184
Chapter 9 Recursion 191
9.1 Concept The Activation Stack 192
9.2 Recursion Defined 193
9.3 Implementing a Recursive Function in MATLAB 194
9.4 Exceptions 196
9.5 Wrapper Functions 200
9.6 Tail Recursion 203
9.7 Murual Resursion 205
9.8 Generative Recursion 205
9.9 Examples of Recursion 205
9.10 Engineering Example-Robot Arm Motion 211
Chapter 10 Principles of Problem Solving 219
10.1 Solving Simple Problems 220
10.2 Assembling Solution Steps 220
10.3 Summary of Operations 220
10.4 Solving Larger Problems 236
10.5 Engineering Example-Processing Geopolitical Data 238
Chapter 11 Plotting 247
11.1 Plotting 248
11.2 2-D Plotting 252
11.3 3-D Plotting 258
11.4 Surface Plots 261
11.5 Interacting with Plotted Data 279
11.6 Engineering Example-Visualizing Geographic Data 283
Chapter 12 Matrices 293
12.1 Concept Behavioral Abstraction 294
12.2 Matrix Operations 294
12.3 MATLAB Implementation 297
12.4 Rotating Coordinates 300
12.5 Solving Simultaneous Linear Equations 307
12.6 Engineering Examples 311
Chapter 13 Images 319
13.1 NAture of an Image 320
13.2 Image Types 321
13.3 Reading, Displaying, and Writing Images 323
13.4 Operating on Images 323
13.5 Engineering Example-Detecting Edges 339
Chapter 14 Processing Sound 347
14.1 The Physics of Sound 348
14.2 Recording and Playback 348
14.3 MATLAB Implementation 349
14.4 Time Domain Operations 350
14.5 The Fast Fourier Transform 359
14.6 Frequency Domain Operations 364
14.7 Engineering Example-Oil Rig Structural Integrity 371
Chapter 15 Numerical Methods 379
15.1 Interpolation 380
15.2 Curve Fitting 384
15.3 Numerical Integration 390
15.4 Numerical Differentiation 394
15.5 Engineering Example-Analyzing Rocket Data 397
15.6 Engineering Example-Cleaning up Images 402
Chapter 16 Sorting 411
16.1 Measuring Algorithm Cost 412
16.2 Algorithms for Sorting Data 415
16.3 Performance Analysis 425
16.4 Applications of Sorting Algorithms 426
16.5 Engineering Examples-A Selection of Countries 430
Chapter 17 Searching Graphs (online)
Chapter 18 Object-Oriented Programming (online)
Chapter 19 Linked Lists (online)
Chapter 20 Binary Trees (online)
Chapter 21 N-ary Trees and Graphs (online)
Chapter 22 The Cost of Computing (online)
Appendices
Appendix A MATLAB Special Characters, Reserved Words, and Symbols A-I
Appendix B The ASCII Character Set B-I
Appendix C Internal Number Representation C-I
Appendix D Web Reference Materials (online)
Appendix E Answers to True or False and Fill in the Blanks (online)
Index I-I