Mastering MATLAB 7

by Duane Hanselman and Bruce Littlefield

Contents

PREFACE

1 GETTING STARTED

1.1 Introduction
1.2 Typographical Conventions
1.3 What's New in MATLAB 7
1.4 What's in Mastering MATLAB 7

2 BASIC FEATURES

2.1 Simple Math
2.2 The MATLAB Workspace
2.3 About Variables
2.4 Comments, Punctuation, and Aborting Execution
2.5 Complex Numbers
2.6 Floating-Point Arithmetic
2.7 Mathematical Functions

3 THE MATLAB DESKTOP

3.1 MATLAB Windows
3.2 Managing the MATLAB Workspace
3.3 Memory Management
3.4 Number Display Formats
3.5 Keeping a Session Log
3.6 System Information
3.7 The MATLAB Search Path

4 SCRIPT M-FILES

4.1 Script M-file Use
4.2 Block Comments and Code Cells
4.3 Setting Execution Time
4.4 Startup and Finish

5 ARRAYS AND ARRAY OPERATIONS

5.1 Simple Arrays
5.2 Array Addressing or Indexing
5.3 Array Construction
5.4 Array Orientation
5.5 Scalar-Array Mathematics
5.6 Array-Array Mathematics
5.7 Standard Arrays
5.8 Array Manipulation
5.9 Array Sorting
5.10 Subarray Searching
5.11 Array Manipulation Functions
5.12 Array Size
5.13 Arrays and Memory Utilization

6 MULTIDIMENSIONAL ARRAYS

6.1 Array Construction
6.2 Array Mathematics and Manipulation
6.3 Array Size

7 NUMERIC DATA TYPES

7.1 Integer Data Types
7.2 Floating Point Data Types
7.3 Summary

8 CELL ARRAYS AND STRUCTURES

8.1 Cell Array Creation
8.2 Cell Array Manipulation
8.3 Retrieving Cell Array Content
8.4 Comma-Separated Lists
8.5 Cell Functions
8.6 Cell Arrays of Strings
8.7 Structure Creation
8.8 Structure Manipulation
8.9 Retrieving Structure Content
8.10 Comma-Separated Lists (Again)
8.11 Structure Functions
8.12 Summary

9 CHARACTER STRINGS

9.1 String Construction
9.2 Numbers to Strings to Numbers
9.3 String Evaluation
9.4 String Functions
9.5 Cell Arrays of Strings
9.6 Searching Using Regular Expressions

10 RELATIONAL AND LOGICAL OPERATIONS

10.1 Relational Operators
10.2 Logical Operators
10.3 Operator Precedence
10.4 Relational and Logical Functions

10.5 NaNs and Empty Arrays

11 CONTROL FLOW

11.1 For Loops
11.2 While Loops
11.3 If-Else-End Constructions
11.4 Switch-Case Constructions
11.5 Try-Catch Blocks

12 FUNCTIONS

12.1 M-file Function Construction Rules
12.2 Input and Output Arguments
12.3 Function Workspaces
12.4 Functions and the MATLAB Search Path
12.5 Creating Your Own Toolbox
12.6 Command-Function Duality
12.7 Function Handles and Anonymous Functions
12.8 Nested Functions

13 M-FILE DEBUGGING AND PROFILING

13.1 Debugging Tools
13.2 Syntax Checking and File Dependencies
13.3 Profiling M-files

14 FILE AND DIRECTORY MANAGEMENT

14.1 Native Data Files
14.2 Data Import and Export
14.3 Low-Level File I/O
14.4 Directory Management
14.5 FTP File Operations

15 SET, BIT, AND BASE FUNCTIONS

15.1 Set Functions
15.2 Bit Functions
15.3 Base Conversions

16 TIME COMPUTATIONS

16.1 Current Date and Time
16.2 Date Format Conversions
16.3 Date Functions
16.4 Timing Functions
16.5 Plot Labels

17 MATRIX ALGEBRA

17.1 Sets of Linear Equations
17.2 Matrix Functions
17.3 Special Matrices
17.4 Sparse Matrices
17.5 Sparse Matrix Functions

18 DATA ANALYSIS

18.1 Basic Statistical Analysis
18.2 Basic Data Analysis
18.3 Data Analysis and Statistical Functions

19 DATA INTERPOLATION

19.1 One-Dimensional Interpolation
19.2 Two-Dimensional Interpolation
19.3 Triangulation and Scattered Data
19.4 Summary

20 POLYNOMIALS

20.1 Roots
20.2 Multiplication
20.3 Addition
20.4 Division
20.5 Derivatives and Integrals
20.6 Evaluation
20.7 Rational Polynomials
20.8 Curve Fitting

21 CUBIC SPLINES

21.1 Basic Features
21.2 Piecewise Polynomials
21.3 Cubic Hermite Polynomials
21.4 Integration
21.5 Differentiation
21.6 Spline Interpolation on a Plane

22 FOURIER ANALYSIS

22.1 Discrete Fourier Transform
22.2 Fourier Series

23 OPTIMIZATION

23.1 Zero Finding
23.2 Minimization in One Dimension
23.3 Minimization in Higher Dimensions
23.4 Practical Issues

24 INTEGRATION AND DIFFERENTIATION

24.1 Integration
24.2 Differentiation

25 DIFFERENTIAL EQUATIONS

25.1 IVP Format
25.2 ODE Suite Solvers
25.3 Basic Use
25.4 Setting Options
25.5 BVPs, PDEs and DDEs

26 TWO-DIMENSIONAL GRAPHICS

26.1 The plot Function
26.2 Linestyles, Markers, and Colors
26.3 Plot Grids, Axes Box, and Labels
26.4 Customizing Plot Axes
26.5 Multiple Plots
26.6 Multiple Figures
26.7 Subplots
26.8 Interactive Plotting Tools
26.9 Screen Updates
26.10 Specialized 2-D Plots
26.11 Easy Plotting
26.12 Text Formatting
26.13 Summary

27 THREE-DIMENSIONAL GRAPHICS

27.1 Line Plots
27.2 Scalar Functions of Two Variables
27.3 Mesh Plots
27.4 Surface Plots
27.5 Mesh and Surface Plots of Irregular Data
27.6 Changing Viewpoints
27.7 Camera Control
27.8 Contour Plots
27.9 Specialized 3-D Plots
27.10 Volume Visualization
27.11 Easy Plotting
27.12 Summary

28 USING COLOR AND LIGHT

28.1 Understanding Colormaps
28.2 Using Colormaps
28.3 Displaying Colormaps
28.4 Creating and Altering Colormaps
28.5 Using Color to Describe a Fourth Dimension
28.6 Lighting Models
28.7 Summary

29 IMAGES, MOVIES, AND SOUND

29.1 Images
29.2 Image Formats
29.3 Image Files
29.4 Movies
29.5 Image Utilities
29.6 Sound
29.7 Summary

30 PRINTING AND EXPORTING GRAPHICS

30.1 Printing and Exporting Using Menus
30.2 Command Line Printing and Exporting
30.3 Printers and Export File Formats
30.4 PostScript Support
30.5 Choosing a Renderer
30.6 Handle Graphics Properties
30.7 Setting Defaults
30.8 Summary

31 HANDLE GRAPHICS

31.1 Objects
31.2 Object Handles
31.3 Object Properties
31.4 get and set
31.5 Finding Objects
31.6 Selecting Objects with the Mouse
31.7 Position and Units
31.8 Default Properties
31.9 Common Properties
31.10 Plot Objects
31.11 Group Objects
31.12 Annotation Axes
31.13 Linking Objects
31.14 New Plots
31.15 Rendering Speed
31.16 Callbacks
31.17 M-file Examples
31.18 Summary

32 GRAPHICAL USER INTERFACES

32.1 What's a GUI?
32.2 Predefined Dialog Boxes
32.3 M-file Dialog Boxes
32.4 Dialog Box Summary
32.5 GUI Object Hierarchy
32.6 GUI Creation Fundamentals
32.7 GUI Object Size and Position
32.8 Capturing Mouse Actions
32.9 The Event Queue

32.10 Callback Programming
32.11 M-file Examples
32.12 GUIDE
32.13 Summary

33 MATLAB CLASSES AND OBJECT-ORIENTED PROGRAMMING

33.1 Overloading
33.2 Class Creation
33.3 Subscripts
33.4 Converter Functions
33.5 Precedence, Inheritance, and Aggregation

34 MATLAB PROGRAMMING INTERFACES

34.1 Accessing MATLAB Arrays
34.2 Calling C or FORTRAN from MATLAB
34.3 Calling MATLAB from C or FORTRAN
34.4 Exchanging Data with MAT-files
34.5 Shared Libraries
34.6 Serial Communications
34.7 Source Code Control Systems
34.8 Summary

35 EXTENDING MATLAB WITH JAVA

35.1 Java Overview
35.2 Java Classes
35.3 Java Objects
35.4 Java Methods
35.5 Object Properties
35.6 Data Exchange
35.7 Java Arrays
35.8 Java Functions
35.9 Examples
35.10 Summary

36 WINDOWS APPLICATION INTEGRATION

36.1 COM Objects: Client/Server Communication
36.2 Dynamic Data Exchange
36.3 MATLAB Notebook
36.4 MATLAB COM-related Toolboxes
36.5 Summary

37 GETTING HELP

37.1 Command Window Help
37.2 The Help Browser
37.3 Internet Resources
37.4
Mastering MATLAB 7 Help
37.5 Summary

38 EXAMPLES, EXAMPLES, EXAMPLES

38.1 Vectorization

38.2 JIT-Acceleration
38.3 Up-Down Sequence
38.4 Vandermonde Matrix
38.5 Repeated Value Creation and Counting

38.6 Differential Sums
38.7 Structure Manipulation

38.8 Inverse Interpolation
38.9 Polynomial Fitting
38.10 Nonlinear Curve Fitting
38.11 Picture-in-a-Picture Zoom

APPENDIX: MATLAB RELEASE INFOMATION

INDEX