Logical operators.
any - True if any element of vector is nonzero
all - True if all elements of vector are nonzero
Set operators.
union - Set union.
unique - Set unique.
intersect - Set intersection.
setdiff - Set difference.
setxor - Set exclusive-or.
ismember - True for set member.
Sparse Matrices
find - Find indices and values of nonzero elements
nnz - Number of nonzero matrix elements
nonzeros - Nonzero matrix elements
Random Number Generators
See also “Random Number Generators” in MATLAB HELP.
randperm - Random permutation
randperm(n) returns a random permutation of the integers 1:n.
randn - Normally distributed random numbers
RANDN(N) returns an N-by-N matrix containing pseudo-random values drawn from a normal distribution with mean zero and standard deviation one.
rand - Uniformly distributed pseudorandom numbers
RAND(N) returns a N-by-N matrix containing pseudo-random, scalar value drawn from a uniform distribution on the unit interval
mvnrnd - Multivariate normal random numbers
Rounding and Remainder
ceil - Round toward infinity
fix - Round toward zero floor - Round toward minus infinity
idivide - Integer division with rounding option
mod - Modulus after division
rem - Remainder after division
round - Round to nearest integer
Dynamic expression and function
eval - Execute string containing MATLAB® expression
feval - Evaluate function
Arrays and Matrices – Basic Information
isempty - Determine whether array is empty
isequal - Test arrays for equality
isfinite - Array elements that are finite
isinf - Array elements that are infinite
isnan - Array elements that are NaN
length - Length of vector
max - Largest elements in array
min - Smallest elements in array
ndims - Number of array dimensions
numel - Number of elements in array or subscripted array
expression
size - Array dimensions
Arrays and Matrices – Elementary Matrices and Arrays
diag - Diagonal matrices and diagonals of matrix
eye - Identity matrix
ones - Create array of all ones
zeros - Create array of all zeros
Arrays and Matrices – Array Manipulation
repmat - Replicate and tile array
reshape - Reshape array
sort - Sort array elements in ascending or descending order
sortrows - Sort rows in ascending orde
Linear Algebra – Matrix Analysis
cond - Condition number with respect to inversion
The condition number of a matrix measures the sensitivity of the solution of a system of linear equations to errors in the data. It gives an indication of the accuracy of the results from matrix inversion and the linear equation solution. Values of cond(X) and cond(X,p) near 1 indicate a well-conditioned matrix.
rcond - Matrix reciprocal condition number estimate
c = rcond(A) returns an estimate for the reciprocal of the condition of A in 1-norm using the LAPACK condition estimator. If A is well conditioned, rcond(A) is near 1.0. If A is badly conditioned, rcond(A) is near 0.0. Compared to cond, rcond is a more efficient, but less reliable, method of estimating the condition of a matrix.
condeig - Condition number with respect to eigenvalues
Large condition numbers imply that A is near a matrix with multiple eigenvalue
det - Matrix determinant
norm - Vector and matrix norms
rank - Rank of matrix
sqrtm - Matrix square root
Linear Algebra – Linear Equations
chol - Cholesky factorization
lu - LU matrix factorization
svd - Singular value decomposition
qr - Orthogonal-triangular decomposition
qz - QZ factorization for generalized eigenvalues
Linear Algebra – Inverse
inv - Matrix inverse
pinv - Moore-Penrose pseudoinverse of matrix
Math Constants
eps - Floating-point relative accuracy
I - Imaginary unit
Inf - Infinity
intmax - Largest value of specified integer type
intmin - Smallest value of specified integer type
j - Imaginary unit
NaN - Not-a-Number
pi - Ratio of circle's circumference to its diameter, π
realmax - Largest positive floating-point number
realmin - Smallest positive normalized floating-point number
Descriptive Statistics
corrcoef - Correlation coefficients
cov - Covariance matrix
max - Largest elements in array
mean - Average or mean value of array
median - Median value of array
min - Smallest elements in array
mode - Most frequent values in array std - Standard deviationvarVarianc
Strings
sprintf - Write formatted data to string
sscanf - Read formatted data from string
strcat - Concatenate strings horizontally
strcmp,strcmpi - Compare strings strmatch - Find possible matches for string
strncmp, strncmpi - Compare first n characters of strings
str2num - Convert string to number
num2str - Convert number to string
Logical
all - Determine whether all array elements are nonzero
any - Determine whether any array elements are nonzero
find - Find indices and values of nonzero elements
File Name Construction
filemarker - Character to separate file name and internal function name
fileparts - Parts of file name and path
filesep - Directory separator for current platform
fullfile - Build full filename from parts
tempdir - Name of system's temporary directory
tempname - Unique name for temporary file
Graphics -Printing and Exporting
See also “Printing and Exporting” in MATLAB HELP.
saveas - Save figure or Simulink block diagram using specified format
print - Print figure or save to file and configure printer defaults.
Graphics - getting and changing properties
gca - Current axes handle
h = gca returns the handle to the current axes for the current figure. See also “Axes Properties” in MATLAB HELP, which can be modified using get and set.
gcf- Current figure handle
h = gcf returns the handle of the current figure. See also “Figure Properties” in MATLAB HELP, which can be modified using get and set.
get- Query object properties
Example:
get(get(gca,'Children'),'HandleVisibility');
set - Set object properties
Example:
set(gca,'Color','b');
Graphics – plotting function
fplot - Plot function between specified limits
fplot(fun,limits)plotsfunbetween the limits specified bylimits.limitsis a vector specifying thex-axis limits ([xminxmax]), or thex- andy-axes limits, ([xminxmaxyminymax]).
fun must be
- The name of an M-file function
- A string with variable x that may be passed to eval , such as 'sin(x)' , 'diric(x,10)' , or '[sin(x),cos(x)]'
- A function handle for an M-file function or an anonymous function
Graphics – Annotating
See also “Annotating Graphs” in MATLAB HELP.
text- Text annotation
TEXT(X,Y,'string') adds the text in the quotes to location (X,Y)on the current axes.
legend- Display legend
Development Environment
clc- Clear Command Window
diary- Save session to file
clear- Remove items from workspace, freeing up system memory
exist- Check existence of variable, function, directory, or Java™ programming language class
isfield- Determine whether input is structure array field
who, whos- List variables in workspace
profile- Profile execution time for function
disp- Display text or array
datestr- Convert date and time to string format. see also "Date and Time Functions".
mfilename- Name of currently running M-file
run- Run script that is not on current path
run('../PROGLIB/stprtool/stprpath')
Labels: MATLAB
Read more!