MATLAB Programming References
This page provides links to short summaries of MATLAB Programming syntax and technique.
Look at the Examples page for more complete examples of applying MATLAB to a computational task.
Compact list of reference articles
- MATLAB Vocabulary
- Create Vectors and Matrices
- Colon Notation
- Create 2D Plots
- Creating and Calling Functions
- for loops
- while loops
Reference articles with short descriptions
MATLAB Vocabulary
Download a PDF document that lists basic MATLAB commands and summarizes concepts in MATLAB programming.
Create Vectors and Matrices
All MATLAB variables are matrices. Vectors are special cases of a matrix with only one row or one column. Scalars are a matrix with one row and one column.
The linspace
, ones
, zeros
functions and the transpose operator are used
to create vectors and matrices. The length
and size
functions are used
to inquire about the number of elements in vectors and matrices.
Colon Notation
Colon notation is a powerful shorthand for creating vectors. It is especially helpful when used to create ranges of subscripts to select parts of vectors or matrices.
Create 2D Plots
The versatile plot
command is used to create 2D line and scatter plots.
Creating and Calling Functions
MATLAB functions are subprograms that contain a sequence of MATLAB commands,
and that are stored in separate m-files. An m-file is a plain text file with
the file extension .m
.
for loops
for
loops are usually designed to be repreated a prescribed number of times.
See while
loops for the alternative looping structure
while loops
while
loops are usually designed to be repeated until a condition is met.
See for
loops for the alternative looping structure