You are previewing A Guide to MATLAB, Second Edition.
O'Reilly logo
A Guide to MATLAB, Second Edition

Book Description

This is a short, focused introduction to MATLAB, a comprehensive software system for mathematical and technical computing. It contains concise explanations of essential MATLAB commands, as well as easily understood instructions for using MATLAB's programming features, graphical capabilities, simulation models, and rich desktop interface. Written for MATLAB 7, it can also be used with earlier (and later) versions of MATLAB. This book teaches how to graph functions, solve equations, manipulate images, and much more. It contains explicit instructions for using MATLAB's companion software, Simulink, which allows graphical models to be built for dynamical systems. MATLAB's new "publish" feature is discussed, which allows mathematical computations to be combined with text and graphics, to produce polished, integrated, interactive documents. For the beginner it explains everything needed to start using MATLAB, while experienced users making the switch to MATLAB 7 from an earlier version will also find much useful information here.

Table of Contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright
  5. Contents
  6. Preface
    1. Why We Wrote This Book
    2. Who Should Read This Book
    3. How This Book Is Organized
    4. Conventions Used in This Book
    5. About the Authors
  7. 1. Getting Started
    1. Platforms and Versions
    2. Installation
    3. Starting MATLAB
    4. Typing in the Command Window
    5. Online Help
    6. MATLAB Windows
    7. Ending a Session
  8. 2. MATLAB Basics
    1. Input and Output
    2. Arithmetic
    3. Recovering from Problems
      1. Errors in Input
      2. Aborting Calculations
    4. Algebraic or Symbolic Computation
      1. Substituting in Symbolic Expressions
      2. Symbolic Expressions, Variable Precision, and Exact Arithmetic
    5. Vectors and Matrices
      1. Vectors
      2. Matrices
    6. Suppressing Output
    7. Functions
      1. Built-in Functions
      2. User-Defined Functions
    8. Managing Variables
    9. Variables and Assignments
    10. Solving Equations
    11. Graphics
      1. Graphing with ezplot
      2. Modifying Graphs
      3. Graphing with plot
      4. Plotting Multiple Curves
  9. 3. Interacting with MATLAB
    1. The MATLAB Interface
      1. The Desktop
      2. The Workspace
      3. The Current Directory and Search Path
      4. The Command History Window
    2. M-Files
      1. Script M-Files
      2. Function M-Files
    3. Loops
    4. Presenting Your Results
      1. Publishing an M-File
      2. Diary Files
      3. Interactive M-Files
      4. Wrapping Long Input and Output Lines
      5. Printing and Saving Graphics
      6. M-Books
    5. Fine-Tuning Your M-Files
  10. Practice Set A: Algebra and Arithmetic
  11. 4. Beyond the Basics
    1. Suppressing Output
    2. Data Classes
      1. String Manipulation
      2. Symbolic and Floating-Point Numbers
    3. Functions and Expressions
      1. Substitution
    4. More about M-Files
      1. Variables in Script M-Files
      2. Variables in Function M-Files
      3. Structure of Function M-Files
    5. Complex Arithmetic
    6. More on Matrices
      1. Solving Linear Systems
      2. Calculating Eigenvalues and Eigenvectors
    7. Doing Calculus with MATLAB
      1. Differentiation
      2. Integration
      3. Limits
      4. Sums and Products
      5. Taylor Series
    8. Default Variables
  12. 5. MATLAB Graphics
    1. Two-Dimensional Plots
      1. Parametric Plots
      2. Contour Plots and Implicit Plots
      3. Field Plots
    2. Three-Dimensional Plots
      1. Curves in Three-Dimensional Space
      2. Surfaces in Three-Dimensional Space
    3. Figure Windows
      1. Multiple Figure Windows
      2. The Figure Toolbar
      3. Combining Plots in One Window
    4. Customizing Graphics
      1. Annotation
      2. Change of Plot Style
      3. Full-Fledged Customization
    5. Images, Animations, and Sound
      1. Images
      2. Animations
      3. Sound
  13. Practice Set B: Calculus, Graphics, and Linear Algebra
  14. 6. MATLAB Programming
    1. Branching
      1. Branching with if
      2. Logical Expressions
      3. Branching with switch
    2. More about Loops
      1. Open-Ended Loops
      2. Breaking from a Loop
    3. Other Programming Commands
      1. Subfunctions
      2. Cell and Structure Arrays
      3. Commands for Parsing Input and Output
      4. Evaluation and Function Handles
      5. User Input and Screen Output
      6. Debugging
    4. Interacting with the Operating System
      1. Calling External Programs
      2. File Input and Output
  15. 7. Publishing and M-Books
    1. Fine Points of Publishing
    2. More on M-Books
      1. The Notebook Menu Items
      2. M-Book Graphics
      3. More Hints for Effective Use of M-Books
  16. 8. Simulink
    1. A Simple Differential Equation
    2. An Engineering Example
    3. Communication with the Workspace
  17. 9. GUIs
    1. GUI Layout and GUIDE
    2. Saving and Running a GUI
    3. GUI Callback Functions
  18. 10. Applications
    1. Illuminating a Room
    2. Mortgage Payments
    3. Monte Carlo Simulation
    4. Population Dynamics
    5. Linear Economic Models
    6. Linear Programming
    7. The 360° Pendulum
    8. Numerical Solution of the Heat Equation
    9. A Model of Traffic Flow
  19. Practice Set C: Developing Your MATLAB Skills
  20. 11. Troubleshooting
    1. Common Problems
      1. Wrong or Unexpected Output
      2. Syntax Error
      3. Spelling Error
      4. Error or Warning Messages When Plotting
      5. A Previously Saved M-File Evaluates Differently
      6. Computer Won’t Respond
    2. The Most Common Mistakes
    3. Debugging Techniques
  21. Solutions to the Practice Sets
    1. Solutions to Practice Set A: Algebra and Arithmetic
    2. Solutions to Practice Set B: Calculus, Graphics, and Linear Algebra
    3. Solutions to Practice Set C: Developing Your MATLAB Skills
  22. Glossary
  23. Index