[go to previous section]

19. Reference

There are many MATLAB features which cannot be included in these introductory notes. Listed below are some of the MATLAB functions and operators available, grouped by subject area. [Source: MATLAB User's Guide, version 3.5] Use the on-line help facility or consult the User's Guide for more detailed information on the functions.

There are many functions beyond these. There exist, in particular, several "toolboxes" of functions for specific areas; included among such are signal processing, control systems, robust-control, system identification, optimization, splines, chemometrics, mu-analysis and synthesis, state-space identification, and neural networks. [The toolboxes, which are optional, may not be installed on your system.] These can be explored via the command help.

[Note: Some of the following tables require a tables-aware browser, such as Netscape 1.1N or later. - Ed.]

help help facility
demo run demonstrations
who list variables in memory
what list M-files on disk
size row and column dimensions
length vector length
clear clear workspace
computer type of computer
^C local abort
exit exit MATLAB
quit same as exit


Matrix Operators Array Operators
+ addition
- subtraction
* multiplication
/ division
\ left division
^ power
' conjugate transpose
+ addition
- subtraction
.* multiplication
./ division
.\ left division
.^ power
.' transpose


Relational and Logical Operators
< less than
<= less than or equal
> greater than
>= greater than or equal
== equal
~= not equal
& and
| or
~ not


Special Characters
= assignment statement
[ used to form vectors and matrices
] see [
( arithmetic expression precedence
) see (
. decimal point
... continue statement to next line
, separate subscripts and function arguments
; end rows, suppress printing
% comments
: subscripting, vector generation
! execute operating system command


Special Values
ans answer when expression not assigned
eps floating point precision
pi 3.14159...
i, j sqrt(-1)
inf infinity
NaN Not-a-Number
clock wall clock
date date
flops floating point operation count
nargin number of function input arguments
nargout number of function output arguments


Disk Files
chdir change current directory
delete delete file
diary diary of the session
dir directory of files on disk
load load variables from file
save save variables to file
type list function or file
what show M-files on disk
fprintf write to a file
pack compact memory via save


Special Matrices
compan companion
diag diagonal
eye identity
gallery esoteric
hadamard Hadamard
hankel Hankel
hilb Hilbert
invhilb inverse Hilbert
linspace linearly spaced vectors
logspace logarithmically spaced vectors
magic magic square
meshdom domain for mesh points
ones constant
pascal Pascal
rand random elements
toeplitz Toeplitz
vander Vandermonde
zeros zero


Matrix Manipulation
rot90 rotation
fliplr flip matrix left-to-right
flipud flip matrix up-to-down
diag diagonal matrices
tril lower triangular part
triu upper triangular part
reshape reshape
.' transpose
: convert matrix to single column; A(:)


Relational and Logical Functions
any logical conditions
all logical conditions
find find array indices of logical values
isnan detect NaNs
finite detect infinities
isempty detect empty matrices
isstr detect string variables
strcmp compare string variables


Control Flow
if conditionally execute statements
elseif used with if
else used with if
end terminate if, for, while
for repeat statements a number of times
while do while
break break out of for and while loops
return return from functions
pause pause until key pressed


Programming and M-Files
input get numbers from keyboard
keyboard call keyboard as M-file
error display error message
function define function
eval interpret text in variables
feval evaluate function given by string
echo enable command echoing
exist check if variables exist
casesen set case sensitivity
global define global variables
startup startup M-file
getenv get environment string
menu select item from menu
etime elapsed time


Text and Strings
abs convert string to ASCII values
eval evaluate text macro
num2str convert number to string
int2str convert integer to string
setstr set flag indicating matrix is a string
sprintf convert number to string
isstr detect string variables
strcomp compare string variables
hex2num convert hex string to number


Command Window
clc clear command screen
home move cursor home
format set output display format
disp display matrix or text
fprintf print formatted number
echo enable command echoing


Graph Paper
plot linear X-Y plot
loglog loglog X-Y plot
semilogx semi-log X-Y plot
semilogy semi-log X-Y plot
polar polar plot
mesh 3-dimensional mesh surface
contour contour plot
meshdom domain for mesh plots
bar bar charts
stairs stairstep graph
errorbar add error bars


Graph Annotation
title plot title
xlabel x-axis label
ylabel y-axis label
grid draw grid lines
text arbitrarily position text
gtext mouse-positioned text
ginput graphics input


Graph Window Control
axis manual axis scaling
hold hold plot on screen
shg show graph window
clg clear graph window
subplot split graph window


Graph Window Hardcopy
print send graph to printer
prtsc screen dump
meta graphics metafile


Elementary Math Functions
abs absolute value or complex magnitude
angle phase angle
sqrt square root
real real part
imag imaginary part
conj complex conjugate
round round to nearest integer
fix round toward zero
floor round toward $-\infty$
ceil round toward $\infty$
sign signum function
rem remainder
exp exponential base e
log natural logarithm
log10 log base 10


Trigonometric Functions
sin sine
cos cosine
tan tangent
asin arcsine
acos arccosine
atan arctangent
atan2 four quadrant arctangent
sinh hyperbolic sine
cosh hyperbolic cosine
tanh hyperbolic tangent
asinh hyperbolic arcsine
acosh hyperbolic arccosine
atanh hyperbolic arctangent


Special Functions
bessel bessel function
gamma gamma function
rat rational approximation
erf error function
inverf inverse error function
ellipk complete elliptic integral of first kind
ellipj Jacobian elliptic integral


Decompositions and Factorizations
balance balanced form
backsub backsubstitution
cdf2rdf convert complex-diagonal to real-diagonal
chol Cholesky factorization
eig eigenvalues and eigenvectors
hess Hessenberg form
inv inverse
lu factors from Gaussian elimination
nnls nonnegative least squares
null null space
orth orthogonalization
pinv pseudoinverse
qr orthogonal-triangular decomposition
qz QZ algorithm
rref reduced row echelon form
schur Schur decomposition
svd singular value decomposition


Matrix Conditioning
cond condition number in 2-norm
norm 1-norm,2-norm,F-norm,$\infty$-norm
rank rank
rcond condition estimate (reciprocal)


Elementary Matrix Functions
expm matrix exponential
logm matrix logarithm
sqrtm matrix square root
funm arbitrary matrix function
poly characteristic polynomial
det determinant
trace trace
kron Kronecker tensor product


poly characteristic polynomial
roots polynomial roots---companion matrix method
roots1 polynomial roots---Laguerre's method
polyval polynomial evaluation
polyvalm matrix polynomial evaluation
conv multiplication
deconv division
residue partial-fraction expansion
polyfit polynomial curve fitting


Column-wise Data Analysis
max maximum value
min minimum value
mean mean value
median median value
std standard deviation
sort sorting
sum sum of elements
prod product of elements
cumsum cumulative sum of elements
cumprod cumulative product of elements
diff approximate derivatives
hist histograms
corrcoef correlation coefficients
cov covariance matrix
cplxpair reorder into complex pairs


Signal Processing
abs complex magnitude
angle phase angle
conv convolution
corrcoef correlation coefficients
cov covariance
deconv deconvolution
fft radix-2 fast Fourier transform
fft2 two-dimensional FFT
ifft inverse fast Fourier transform
ifft2 inverse 2-D FFT
fftshift FFT rearrangement


Numerical Integration
quad numerical function integration
quad8 numerical function integration


Differential Equation Solution
ode23 2nd/3rd order Runge-Kutta method
ode45 4th/5th order Runge-Kutta-Fehlberg method


Nonlinear Equations and Optimization
fmin minimum of a function of one variable
fmins minimum of a multivariable function
fsolve solution of a system of nonlinear equations
(zeros of a multivariable function)
fzero zero of a function of one variable


spline cubic spline
table1 1-D table look-up
table2 2-D table look-up

[return to Table of Contents]