Highlighting the new aspects of MATLAB® 7.10 and expanding on many existing features, MATLAB® Primer, Eighth Edition shows you how to solve problems in science, engineering, and mathematics. Now in its eighth edition, this popular primer continues to offer a hands-on, step-by-step introduction to using the powerful tools of MATLAB.
New to the Eighth Edition
- A new chapter on object-oriented programming
- Discussion of the MATLAB File Exchange window, which provides direct access to over 10,000 submissions by MATLAB users
- Major changes to the MATLAB Editor, such as code folding and the integration of the Code Analyzer (M-Lint) into the Editor
- Explanation of more powerful Help tools, such as quick help popups for functions via the Function Browser
- The new bsxfun function
- A synopsis of each of the MATLAB Top 500 most frequently used functions, operators, and special characters
- The addition of several useful features, including sets, logical indexing, isequal, repmat, reshape, varargin, and varargout
The book takes you through a series of simple examples that become progressively more complex. Starting with the core components of the MATLAB desktop, it demonstrates how to handle basic matrix operations and expressions in MATLAB. The text then introduces commonly used functions and explains how to write your own functions, before covering advanced features, such as object-oriented programming, calling other languages from MATLAB, and MATLAB graphics. It also presents an in-depth look at the Symbolic Toolbox, which solves problems analytically rather than numerically.
Getting Started
The MATLAB Desktop
Command window
Command history window
Current folder window
Workspace window
Help window
File exchange window
Variable editor window
Matrices and Matrix Operations
Referencing individual entries
Matrix operators
Matrix division (slash and backslash)
Entry-wise operators
Relational operators
Complex numbers
Strings
Submatrices and Colon Notation
Generating vectors
Accessing submatrices
MATLAB Functions
Constructing matrices
Scalar functions
Vector functions and data analysis
Matrix functions
The linsolve function
The find function
1-D indexing and the reshape function
Logical indexing
The bsxfun and repmat functions
M-Files
M-file editor window
Script files
Function files
Multiple inputs and outputs
Variable arguments
Unused arguments
Comments and documentation
The MATLAB path
Control Flow Statements
The for loop
The while loop
The if statement
The switch statement
The try/catch statement
Matrix expressions (if and while)
Infinite loops
Advanced Data Structures
Cell arrays
Structs
Sets
Other data types
Object-Oriented Programming
Object methods
Object inheritance and abstract classes
Object attributes
A more extensive example
Object handle classes
Advanced M-File Features
Function handles and anonymous functions
Name resolution
Error and warning messages
User input
Performance measures
Efficient code
Code Development Tools
Code analyzer (M-lint) report
Advanced editor features
TODO/FIXME report
Help report
Contents report
Dependency report
Profiler tool and coverage report
File and folder comparison tool
Calling C from MATLAB
A simple example
C versus MATLAB arrays
A matrix computation in C
MATLAB mx and mex routines
Online help for MEX routines
Larger examples on the web
Calling Fortran from MATLAB
Solving a transposed system
A Fortran mexFunction with %val
If you cannot use %val
Calling Java from MATLAB
A simple example
Encryption/decryption
Java class path
Calling your own Java methods
Loading a URL as a matrix
Two-Dimensional Graphics
Planar plots
Multiple figures
Graph of a function
Parametrically defined curves
Titles, labels, text in a graph
Control of axes and scaling
Multiple plots
Line types, marker types, colors
Subplots and specialized plots
Graphics hard copy
Three-Dimensional Graphics
Curve plots
Mesh and surface plots
Parametrically defined surfaces
Volume and vector visualization
Color shading and color profile
Perspective of view
Advanced Graphics
Handle graphics
Graphical user interface
Images
Sparse Matrix Computations
Storage modes
Generating sparse matrices
Computation with sparse matrices
Permutation vectors and matrices
Visualizing matrices
The Symbolic Math Toolbox
Symbolic variables
Calculus
Variable precision arithmetic
Numeric and symbolic substitution
Algebraic simplification
Two-dimensional graphs
Three-dimensional surface graphs
Three-dimensional curves
Symbolic matrix operations
Symbolic linear algebraic functions
Solving algebraic equations
Solving differential equations
Further MuPAD access
Polynomials, Interpolation, and Integration
Representing polynomials
Evaluating polynomials
Polynomial interpolation
Numeric integration (quadrature)
Solving Equations
Symbolic equations
Linear systems of equations
Polynomial roots
Nonlinear equations
Ordinary differential equations
Other differential equations
Displaying Results
Cell Publishing
Appendix A: The MATLAB Top 500
Appendix B: Desktop Tools and Development Environment
Appendix C: Data Import and Export
Appendix D: Mathematics
Appendix E: Data Analysis
Appendix F: Programming and Data Types
Appendix G: Object-Oriented Programming
Appendix H: Graphics
Appendix I: 3-D Visualization
Appendix J: GUI Development
Appendix K: External Interfaces
Appendix L: Symbolic Math Toolbox
Index
Biography
Timothy A. Davis is a professor in the Department of Computer & Information Science & Engineering at the University of Florida. A member of ACM, SIAM, IEEE, IEEE Computer Society, SIAM-SC, SIAM-OPT, and SIAM-CSE, Dr. Davis is an associate editor of both ACM Transactions on Mathematical Software and Computational Optimization and Applications.
This primer is a useful little booklet. It presents language features in a progressive manner, with the easy things first and more sophisticated features built onto these. … it also serves as a reference work and is a useful supplement to the online help that comes with MATLAB itself. … The presentation throughout is clear and concise, with the text enlivened by illustrative examples where appropriate. Altogether, the book is a complete course in MATLAB, including a careful introduction to object-oriented programming and other advanced and powerful features. I highly recommend this book to MATLAB users at all levels of expertise.
—J.C. Butcher, Computing Reviews, October 2011After many years away from MATLAB, I am now picking it up again to do some research in signal processing strategies for cochlear implants. As I got into it, I realized that I had forgotten enough of the details as to be pretty useless so I got this book and started from scratch. I love this book! Extremely well written. I especially like the examples that the author intentionally ‘botched’ in order to make teaching points.
—J. Mark Elder, M.D., Ph.D., Aztek Networks, Inc, Boulder, Colorado, USA