Contents
Preface
1 Introduction
1.1 What Is MATLAB?
1.2 Does MATLAB Do Symbolic Calculations?
1.3 Will MATLAB Run on My Computer?
1.4 Where Do I Get MATLAB ?
1.5 How Do I Use This Book?
1.6 Basics of MATLAB
1.6.1 MATLAB windows
1.6.2 On-line help
1.6.3 Input-output
1.6.4 File types
1.6.5 Platform dependence
1.6.6 General commands you should remember
1.7 Visit This Again
2 Tutorial Lessons
The Basics
2.1 Lesson 1: A Minimum MATLAB Session
2.2 Lesson 2: Creating and Working with Arrays of Numbers
2.3 Lesson 3: Creating and Printing Simple Plots
2.4 Lesson 4: Creating, Saving, and Executing a Script File
2.5 Lesson 5: Creating and Executing a Function File
Directional Explorations
2.6 Lesson 6: Working with Arrays and Matrices
2.7 Lesson 7: Working with anonymous functions
2.8 Lesson 8: Symbolic Computation
2.9 Lesson 9: Importing and Exporting Data
2.10 Lesson 10: Working with Files and Directories
2.11 Lesson 11: Publishing Reports
3 Interactive Computation 67
3.1 Matrices and Vectors
3.1.1 Input
3.1.2 Indexing (or subscripting)
3.1.3 Matrix manipulation
3.1.4 Creating vectors
3.2 Matrix and Array Operations
3.2.1 Arithmetic operations
3.2.2 Relational operations
3.2.3 Logical operations
3.2.4 Elementary math functions
3.2.5 Matrix functions
3.3 Character strings
3.3.1 Manipulating character strings
3.3.2 The eval function
3.4 A Special Note on Array Operations
3.4.1 Vectorization
3.5 Command Line Functions
3.5.1 Inline functions
3.5.2 Anonymous functions
3.6 Using Built-in Functions and On-line Help
3.6.1 Example 1: Finding the determinant of a matrix
3.6.2 Example 2: Finding eigenvalues and eigenvectors
3.7 Saving and Loading Data
3.7.1 Saving into and loading from the binary Mat-_les
3.7.2 Importing data _les
3.7.3 Recording a session with diary
3.8 Plotting Simple Graphs
4 Programming in MATLAB: Scripts and Functions
4.1 Script Files
4.2 Function Files
4.2.1 Executing a function
4.2.2 More on functions
4.2.3 M-Lint code analyzer
4.2.4 Subfunctions
4.2.5 Nested functions
4.2.6 Compiled (parsed) functions: The p-code
4.2.7 The pro_ler
4.3 Language-speci_c Features
4.3.1 Use of comments to create on-line help
4.3.2 Continuation
4.3.3 Global variables
4.3.4 Loops, branches, and control-ow
4.3.5 Interactive input
4.3.6 Recursion
4.3.7 Input/output
4.4 Advanced Data Objects
4.4.1 Multidimensional matrices
4.4.2 Structures
4.4.3 Cells
4.5 Publishing Reports
5 Applications
5.1 Linear Algebra
5.1.1 Solving a linear system
5.1.2 Gaussian elimination
5.1.3 Finding eigenvalues and eigenvectors
5.1.4 Matrix factorizations
5.1.5 Advanced topics
5.2 Curve Fitting and Interpolation
5.2.1 Polynomial curve _tting on the y
5.2.2 Do it yourself: Curve _tting with polynomial functions
5.2.3 Least squares curve _tting
5.2.4 General nonlinear _ts
5.2.5 Interpolation
5.3 Data Analysis and Statistics
5.4 Numerical Integration (Quadrature)
5.4.1 Double integration
5.5 Ordinary Di_erential Equations
5.5.1 Example 1: A _rst-order linear ODE
5.5.2 Example 2: A second-order nonlinear ODE
5.5.3 ode23 versus ode45
5.5.4 Specifying tolerance
5.5.5 The ODE suite
5.5.6 Event location
5.6 Nonlinear Algebraic Equations
5.6.1 Roots of polynomials
5.7 Advanced Topics
6 Graphics
6.1 Basic 2-D Plots
6.1.1 Style options
6.1.2 Labels, title, legend, and other text objects
6.1.3 Axis control, zoom in, and zoom out
6.1.4 Modifying plots with the plot editor
6.1.5 Overlay plots
6.1.6 Specialized 2-D plots
6.2 Using subplot for Multiple Graphs
6.3 3-D Plots
6.3.1 View
6.3.2 Rotate view
6.3.3 Mesh and surface plots
6.3.4 Vector _eld and volumetric plots
6.3.5 Interpolated surface plots
6.4 Handle Graphics
6.4.1 The object hierarchy
6.4.2 Object handles
6.4.3 Object properties
6.4.4 Modifying an existing plot
6.4.5 Complete control over the graphics layout
6.5 Fun with 3-D Surface Graphics
6.5.1 Generating a cylindrical surface
6.5.2 Face color, transparency and light reection
6.5.3 A little more fun with color and lighting
6.5.4 A word about choosing colors
6.6 Saving and Printing Graphs
6.6.1 Saving graphs to reusable _les
6.7 Animation
7 Errors
8 Computer Algebra and The Symbolic Math Toolbox
8.1 The Symbolic Math Toolbox
8.1.1 Should you buy it?
8.1.2 Two useful tools in the Symbolic Math Toolbox
8.2 Numeric vs. symbolic computation
8.2.1 Variable Precision Arithmetic
8.3 Getting help with the Symbolic Math Toolbox
8.4 Using the Symbolic Math Toolbox
8.4.1 Basic manipulations
8.4.2 Talking to itself
8.4.3 Generating MATLAB code for an inline or anonymous function
8.4.4 Generating M-_les from symbolic expressions
8.5 Using MuPAD Notebook
8.5.1 Graphics and animation
8.6 Summary: Some Symbolic Math Toolbox commands
9 Honorable Mentions
9.7 Debugging Tools
9.8 External Interface: Mex-_les
9.9 Graphical User Interface
A The MATLAB Language Reference
A.1 Punctuation Marks and Other Symbols
A.2 General-purpose Commands
A.3 Special Variables and Constants
A.4 Language Constructs and Debugging
A.5 File Input/Output
A.6 Operators and Logical Functions
A.7 Frequently Used Math Functions
A.8 Matrices: Creation and Manipulation
A.9 Character String Functions
A.10 Graphics Functions
A.11 Some Applications Functions
A.11.1 Data analysis and Fourier transforms
A.11.2 Polynomials and data interpolation
A.11.3 Nonlinear numerical methods
Bibliography
Index