MATLAB Function Reference    

Elementary Matrices and Matrix Manipulation

 

Elementary Matrices and Arrays
blkdiag Construct a block diagonal matrix from input arguments
eye Identity matrix
linspace Generate linearly spaced vectors
logspace Generate logarithmically spaced vectors
numel Number of elements in a matrix or cell array
ones Create an array of all ones
rand Uniformly distributed random numbers and arrays
randn Normally distributed random numbers and arrays
zeros Create an array of all zeros
: (colon) Regularly spaced vector

 

Special Variables and Constants
ans The most recent answer
computer Identify the computer on which MATLAB is running
eps Floating-point relative accuracy
i Imaginary unit
Inf Infinity
inputname Input argument name
j Imaginary unit
NaN Not-a-Number
nargin, nargout Number of function arguments
nargoutchk Validate number of output arguments
pi Ratio of a circle's circumference to its diameter,
realmax Largest positive floating-point number
realmin Smallest positive floating-point number
varargin, varargout Pass or return variable numbers of arguments

 

Time and Dates
calendar Calendar
clock Current time as a date vector
cputime Elapsed CPU time
date Current date string
datenum Serial date number
datestr Date string format
datevec Date components
eomday End of month
etime Elapsed time
now Current date and time
tic, toc Stopwatch timer
weekday Day of the week

 

Matrix Manipulation
cat Concatenate arrays
diag Diagonal matrices and diagonals of a matrix
fliplr Flip matrices left-right
flipud Flip matrices up-down
repmat Replicate and tile an array
reshape Reshape array
rot90 Rotate matrix 90 degrees
tril Lower triangular part of a matrix
triu Upper triangular part of a matrix
: (colon) Index into array, rearrange array

 

Vector Functions
cross Vector cross product
dot Vector dot product
intersect Set intersection of two vectors
ismember Detect members of a set
setdiff Return the set difference of two vector
setxor Set exclusive or of two vectors
union Set union of two vectors
unique Unique elements of a vector

 Language Constructs and Debugging Specialized Matrices