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. Use the online help facility, or consult the MATLAB 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, including those for signal processing, control theory, dynamical systems (system identification), and chemometrics. These can be explored via the command
help
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 + addition
- subtraction - subtraction
* multiplication .* multiplication
/ right division ./ right division
\ left division .\ Left division
^ power .^ power
' conjugate transpose .' transpose
less than & and
<= less than or equal | or
> greater than ~ not
>= greater than or equal
== equal
~= not equal
= 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
ans answer when expression not assigned
eps floating point precision
pi 3.14159......
i,j square root of -1
inf oo
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
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
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
rand random elements
toeplitz Toeplitz
vander Vandermonde
zeros zero
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 (: )
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
strcomp compare string variables
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
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
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
home move cursor home
format set output display format
disp display matrix or text
fprintf print formatted number
echo enable command echoing
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
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
axis manual axis scaling
hold hold plot on screen
shg show graph window
clg clear graph window
subplot split graph window
print send graph to printer
prtsc screen dump
meta graphics metafile
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 towards -oo
ceil round toward oo
sign signum function
rem remainder
exp exponential base e
log natural logarithm
logl0 log base 10
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
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
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
cond condition number in 2-norm
norm 1-norm,2-norm,F-norm,oo-norm
rank rank
rcond condition estimate (reciprocal)
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
rootsl polynomial roots-Laguerre's method
polyval polynomial evaluation
polyvalm matrix polynomial evaluation
conv multiplication
deconv division
residue partial-fraction expansion
polyfit polynomial curve fitting
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
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
spline cubic spline
table1 1-D table look-up
table2 2-D table look-up
ode23 2nd/3rd order Runge-Kutta method
ode45 4th/5th order Runge-Kutta-Fehlberg method
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
Click on an item listed below to access additional MATLAB-related hints.
Return to ACS home page.
Please send comments and suggestions to
consult@rpi.edu