Index of Examples
Use this index to find examples in the documentation.
Select the a MATLAB topic area from the following list:
Development Environment
Editing and Debugging M-Files
Debugging Example - The Collatz Problem
Improving M-File Performance - The Profiler
An Example Using the Profiler
Mathematics
Polynomials and Interpolation
Multidimensional Data Gridding
Triangulation and Interpolation of Scattered Data
Data Analysis and Statistics
Analyzing Residuals
Polynomial Fit
Exponential Fit
Error Bounds
Using the Basic Fitting Interface
Using FFT to Calculate Sunspot Periodicity
Function Functions
Minimizing Functions of One Variable
Plotting Mathematical Functions
Computing the Length of a Curve
Differential Equations - Initial Value Problems
ODE Initial Value Problem Examples
Solving an IVP ODE in MATLAB (van der Pol Equation, Nonstiff)
The van der Pol Equation, µ = 1000 (Stiff)
Simple Nonstiff Problem
Stiff Problem (van der Pol Equation)
Finite Element Discretization
Large, Stiff Sparse Problem
Simple Event Location
Advanced Event Location
Differential-Algebraic Problem
Differential Equations - Boundary Value Problems
ODE Boundary Value Problem Examples
Mathieu's Equation
Using Continuation to Solve a Difficult BVP
Using Continuation to Verify a Solution's Consistent Behavior
Partial Differential Equations
PDE Examples
A Single PDE
Electrodynamics Problem
Sparse Matrices
Generating a Second Difference Operator
Programming and Data Types
M-File Programming
Simple Function Example
Simple Script Example
Passing Variable Numbers of Arguments
Checking the Number of Function Arguments
Accessing Single Elements of a Matrix
Accessing Multiple Elements of a Matrix
Expanding the Size of a Matrix
Deleting Rows and Columns
Concatenating Matrices
Subfunctions
Vectorizing Loops
Conversions Between Date Formats
Character Arrays (Strings)
Converting Characters to Numeric Values
Creating Two-Dimensional Character Arrays
Comparing Strings For Equality
Converting to a Cell Array of Strings
Searching and Replacing
Categorizing Characters Within a String
Multidimensional Arrays
Generating Arrays Using Indexing
Generating Arrays Using MATLAB Functions
Building Multidimensional Arrays with the cat Function
Operating on Planes and Matrices
Multidimensional Cell Arrays
Multidimensional Structure Arrays
Structures and Cell Arrays
Building Structure Arrays Using Assignment Statements
Writing Functions to Operate on Structures
Accessing Data in Structure Arrays
Building Nested Structures with the struct Function
Creating Cell Arrays
Replacing Lists of Variables with Cell Arrays
Reshaping Cell Arrays
Accessing Cell Contents Using Content Indexing
Nesting Cell Arrays
Cell Arrays of Structures
Function Handles
Constructing a Function Handle
Function File
Function Methods
Displaying Function Handle Information
Example 1 - A Simple Function Handle
Example 2 - Function Handles and Subfunctions
Converting Function Handles to Function Names
Simple Function Handles
Overloaded Function Handles
Constructor Function Handles
Subfunction Handles
Private Function Handles
Converting Function Names to Function Handles
MATLAB Classes and Objects
A Polynomial Class
How to Write subsref
The Portfolio Container
Designing the Stock Class
Assets and Asset Subclasses
Defining saveobj and loadobj for Portfolio
Graphics
Creating Specialized Plots
Grouped Bar Graph
Detached 3-D Bars
Grouped 3-D Bars
Stacked Bar Graphs to Show Contributing Amounts
Overlaying Plots on Bar Graphs
Comparing Datasets with Area Graphs
Pie Chart
Two-Dimensional Stem Plots
Combining Stem Plots with Line Plots
3-D Stem Plot of an FFT
Combining Stem and Line Plots
Stairstep Plot of a Function
Compass Plot of Wind Direction and Speed
Contour Plot of the Peaks Function
Displaying Contours in Polar Coordinates
Visualizing an FFT as a Movie
Selecting Plotting Points from the Screen
Animating with Erase Modes
Basic Printing and Exporting
Printing to a Printer Using GhostScript
Printing to a Nondefault Printer
Printing to a Printer, Setting the Size of and Centering a Figure
Printing to a Printer, Setting the Paper Size
Printing to a Printer, Locking the Ticks and Limits of the Axes
Printing to a Printer at Screen Size
Printing to a Printer Using the Defaults
Appending a Figure to a PostScript File
Printing a Figure to a File
Exporting a Figure in EPS Format with a TIFF Preview
Exporting a Figure to a File in a Specific Graphics Format
Exporting a Figure to the Clipboard
Handle Graphics Objects
Creating Graphics Objects
Examples - Setting Default LineStyles
Finding Objects
Copying Objects
Using newplot
Figure Properties
Specifying Figure Position
Two Custom Pointers
Axes Properties
Creating Axes with Specific Characteristics
Placing Text Outside the Axes
Multiple Axes for Different Scaling
Setting Tick Mark Locations
Changing Axis Direction
Double Axis Graphs
Calculating Color Limits
3-D Visualization
Creating Surface Plots
Example- Displaying Nonuniform Data on a Surface
Mapping Surface Curvature to Color
Texture Mapping a Surface
Defining the View
Dollying the Camera
Moving the Camera Through a Scene
Moving Toward or Away from the Target
axis Command Options
MATLAB Defaults
Displaying Real Objects
Lighting as a Visualization Tool
Lighting Examples
Illuminating Mathematical Functions
Positioning Lights in Data Space
Defining Patch Objects
Defining a Cube
Specifying Flat Edge and Face Coloring
Volume Visualization Techniques
Visualizing MRI Data
Slicing Fluid Flow Data
Isosurfaces in Fluid Flow Data
Adding Isocaps to an Isosurface
Stream Line Plots of Vector Data
Displaying Curl with Stream Ribbons
Displaying Divergence with Stream Tubes
Creating Stream Particle Animations
Vector Field Displayed with Cone Plots
Creating Graphical User Interfaces
Getting Started with GUIDE
Getting Started Example
Creating GUIs
Passing Data in the Handles Structure
Application Examples
GUI with Multiple Axes
Launching a Dialog to Confirm an Operation
List Box Directory Reader
A GUI to Set Simulink Model Parameters
Accessing Workspace Variables from a List Box
An Address Book Reader
External Interfaces
Calling C and Fortran Programs from MATLAB
The explore Example
Examples From the Text
MEX Reference Examples
MX Examples
Engine and MAT Examples
Creating C Language MEX-Files
Handling 8-,16-, and 32-Bit Data
Handling Complex Data
Passing Structures and Cell Arrays
Passing Two or More Inputs or Outputs
Passing Strings
A First Example -- Passing a Scalar
Handling Sparse Arrays
Manipulating Multidimensional Numerical Arrays
Symmetric Indefinite Factorization Using LAPACK
Persistent Arrays
Calling Functions from C MEX-Files
Creating Fortran MEX-Files
Handling Complex Data
Passing Two or More Inputs or Outputs
Passing Matrices
Passing Arrays of Strings
Passing Strings
A First Example -- Passing a Scalar
Handling Sparse Matrices
Dynamically Allocating Memory
Calling Functions from Fortran MEX-Files
Calling MATLAB from C and Fortran Programs
Calling MATLAB From a C Application
Calling MATLAB From a Fortran Application
Calling Java from MATLAB
Finding the Public Data Fields of an Object
Concatenating Java Objects
Methodsview: Displaying a Listing of Java Methods
Creating an Array of Objects Within MATLAB
Passing Java Objects
Creating a Copy of a Java Array
Creating a New Array Reference
Creating and Using a Phone Book
Communicating Through a Serial Port
Finding an Internet Protocol Address
Reading a URL
Converting to a MATLAB Structure
Converting to a MATLAB Cell Array
Importing and Exporting Data
Creating a MAT-File in Fortran
Reading a MAT-File in C
Creating a MAT-File in C
Reading a MAT-File in Fortran
ActiveX and DDE Support
Using ActiveX Collections
Writing Event Handlers
BSTR Execute([in] BSTR Command);
Using MATLAB As an Automation Client
Using Visual Basic and the MATLAB DDE Server
DDE Advisory Links
Serial Port I/O
Getting Started
Parsing Input Data Using strread
Writing and Reading Text Data
Connecting Two Modems
Using Events and Callbacks
Reading Binary Data
Saving and Loading
Recording Information to Disk