HOLD Hold
current graph.
HOLD ON
holds the current plot and all axis properties so that
subsequent graphing commands add to the existing graph.
HOLD OFF returns to the default mode whereby PLOT commands erase
the previous plots and reset all axis properties before drawing
new plots.
HOLD, by itself, toggles the hold state.
HOLD does not affect axis autoranging properties.
Algorithm note:
HOLD ON
sets the NextPlot property of the current figure and
axes to "add".
HOLD OFF sets the NextPlot property of the current axes to
"replace".
See also ISHOLD, NEWPLOT, FIGURE, AXES.
SUBPLOT
Create axes in tiled positions.
SUBPLOT(m,n,p), or SUBPLOT(mnp), breaks the Figure window into
an mbyn matrix of small axes, selects the pth axes for
for the current plot, and returns the axis handle. The axes
are counted along the top row of the Figure window, then the
second row, etc. For example,
SUBPLOT(2,1,1), PLOT(income)
SUBPLOT(2,1,2), PLOT(outgo)
plots income on the top half of the window and outgo on the
bottom half.
SUBPLOT(m,n,p), if the axis already exists, makes it current.
SUBPLOT(H), where H is an axis handle, is another way of making
an axis current for subsequent plotting commands.
SUBPLOT('position',[left bottom width height]) creates an
axis at the specified position in normalized coordinates (in
in the range from 0.0 to 1.0).
If a SUBPLOT specification causes a new axis to overlap an
existing axis, the existing axis is deleted. For example,
the statement SUBPLOT(1,1,1) deletes all existing smaller
axes in the Figure window and creates a new fullfigure axis.
PLOT3 Plot
lines and points in 3D space.
PLOT3() is a threedimensional analogue of PLOT().
PLOT3(x,y,z), where x, y and z are three vectors of the same length,
plots a line in 3space through the points whose coordinates are the
elements of x, y and z.
PLOT3(X,Y,Z), where X, Y and Z are three matrices of the same size,
plots several lines obtained from the columns of X, Y and Z.
Various line types, plot symbols and colors may be obtained with
PLOT3(X,Y,Z,s) where s is a 1, 2 or 3 character string made from
the characters listed under the PLOT command.
PLOT3(x1,y1,z1,s1,x2,y2,z2,s2,x3,y3,z3,s3,...) combines the plots
defined by the (x,y,z,s) fourtuples, where the x's, y's and z's are
vectors or matrices and the s's are strings.
Example: A helix:
t = 0:pi/50:10*pi;
plot3(sin(t),cos(t),t);
PLOT3 returns a column vector of handles to LINE objects, one
handle per line. The X,Y,Z triples, or X,Y,Z,S quads, can be
followed by parameter/value pairs to specify additional
properties of the lines.
See also PLOT, LINE, AXIS, VIEW, MESH, SURF.
MESHGRID
X and Y arrays for 3D plots.
[X,Y] = MESHGRID(x,y) transforms the domain specified by vectors
x and y into arrays X and Y that can be used for the evaluation
of functions of two variables and 3D surface plots.
The rows of the output array X are copies of the vector x and
the columns of the output array Y are copies of the vector y.
[X,Y] = MESHGRID(x) is an abbreviation for [X,Y] = MESHGRID(x,x).
[X,Y,Z] = MESHGRID(x,y,z) produces 3D arrays that can be used to
evaluate functions of three variables and 3D volumetric plots.
For example, to evaluate the function x*exp(x^2y^2) over the
range 2 < x < 2, 2 < y < 2,
[X,Y] = meshgrid(2:.2:2, 2:.2:2);
Z = X .* exp(X.^2  Y.^2);
mesh(Z)
MESHGRID is like NDGRID except that the order of the first two input
and output arguments are switched (i.e., [X,Y,Z] = MESHGRID(x,y,z)
produces the same result as [Y,X,Z] = NDGRID(y,x,z)). Because of
this, MESHGRID is better suited to problems in cartesian space,
while NDGRID is better suited to ND problems that aren't spatially
based. MESHGRID is also limited to 2D or 3D.
See also SURF, SLICE, NDGRID.
MESH 3D
mesh surface.
MESH(X,Y,Z,C) plots the colored parametric mesh defined by
four matrix arguments. The view point is specified by VIEW.
The axis labels are determined by the range of X, Y and Z,
or by the current setting of AXIS. The color scaling is determined
by the range of C, or by the current setting of CAXIS. The scaled
color values are used as indices into the current COLORMAP.
MESH(X,Y,Z) uses C = Z, so color is proportional to mesh height.
MESH(x,y,Z) and MESH(x,y,Z,C), with two vector arguments replacing
the first two matrix arguments, must have length(x) = n and
length(y) = m where [m,n] = size(Z). In this case, the vertices
of the mesh lines are the triples (x(j), y(i), Z(i,j)).
Note that x corresponds to the columns of Z and y corresponds to
the rows.
MESH(Z) and MESH(Z,C) use x = 1:n and y = 1:m. In this case,
the height, Z, is a singlevalued function, defined over a
geometrically rectangular grid.
MESH returns a handle to a SURFACE object.
AXIS, CAXIS, COLORMAP, HOLD, SHADING and VIEW set figure, axes, and
surface properties which affect the display of the mesh.
See also SURF, MESHC, MESHZ, WATERFALL.
ABS Absolute
value.
ABS(X) is the absolute value of the elements of X. When
X is complex, ABS(X) is the complex modulus (magnitude) of
the elements of X.
See also SIGN, ANGLE, UNWRAP.
Overloaded methods
help sym/abs.m
ECHO Echo
commands in Mfiles.
ECHO ON turns on echoing of commands inside Scriptfiles.
ECHO OFF turns off echoing.
ECHO file ON where 'file' is a function name causes the
named Functionfile to be echoed when it is used.
ECHO file OFF turns it off.
ECHO file toggles it.
ECHO ON ALL turns on the echoing of commands inside any
Functionfiles that are currently in memory (i.e., the
functions returned by INMEM).
ECHO OFF ALL turns them all off.
See also FUNCTION, SCRIPT.
CLF Clear
current figure.
CLF deletes all children of the current figure with visible handles.
CLF RESET deletes children with visible handles and also resets
all figure properties, except Position and Units, to their default
values.
See also CLA, RESET, HOLD.
AXIS Control
axis scaling and appearance.
AXIS([XMIN XMAX YMIN YMAX]) sets scaling for the x and yaxes
on the current plot.
AXIS([XMIN XMAX YMIN YMAX ZMIN ZMAX]) sets the scaling for the
x, y and zaxes on the current 3D plot.
V = AXIS returns a row vector containing the scaling for the
current plot. If the current view is 2D, V has four
components; if it is 3D, V has six components.
AXIS AUTO returns the axis scaling to its default, automatic
mode where, for each dimension, 'nice' limits are chosen based
on the extents of all line, surface, patch, and image children.
AXIS MANUAL freezes the scaling at the current limits, so that if
HOLD is turned on, subsequent plots will use the same limits.
AXIS TIGHT sets the axis limits to the range of the data.
AXIS FILL sets the axis limits and PlotBoxAspectRatio so that
the axis fills the position rectangle. This option only has
an effect if PlotBoxAspectRatioMode or DataAspectRatioMode are
manual.
AXIS IJ puts MATLAB into its "matrix" axes mode. The coordinate
system origin is at the upper left corner. The i axis is
vertical and is numbered from top to bottom. The j axis is
horizontal and is numbered from left to right.
AXIS XY puts MATLAB into its default "Cartesian" axes mode. The
coordinate system origin is at the lower left corner. The x
axis is horizontal and is numbered from left to right. The y
axis is vertical and is numbered from bottom to top.
AXIS EQUAL sets the aspect ratio so that equal tick mark
increments on the x,y and zaxis are equal in size. This
makes SPHERE(25) look like a sphere, instead of an ellipsoid.
AXIS IMAGE is the same as AXIS EQUAL except that the plot
box fits tightly around the data.
AXIS SQUARE makes the current axis box square in size.
AXIS NORMAL restores the current axis box to full size and
removes any restrictions on the scaling of the units.
This undoes the effects of AXIS SQUARE and AXIS EQUAL.
AXIS OFF turns off all axis labeling, tick marks and background.
AXIS ON turns axis labeling, tick marks and background back on.
See also AXES.
EXP
Exponential.
EXP(X) is the exponential of the elements of X, e to the X.
For complex Z=X+i*Y, EXP(Z) = EXP(X)*(COS(Y)+i*SIN(Y)).
See also LOG, LOG10, EXPM, EXPINT.
Overloaded methods
help sym/exp.m
KEYBOARD
Invoke keyboard from Mfile.
KEYBOARD, when placed in an Mfile, stops execution of the file
and gives control to the user's keyboard. The special status is
indicated by a K appearing before the prompt. Variables may be
examined or changed  all MATLAB commands are valid. The keyboard
mode is terminated by executing the command RETURN (i.e. typing
the six letters RETURN and pressing the return key). Control
returns to the invoking Mfile.
The keyboard mode is useful for debugging your Mfiles.
See also DBSTOP, RETURN, INPUT.
ZOOM Zoom in
and out on a 2D plot.
ZOOM with no arguments toggles the zoom state.
ZOOM(FACTOR) zooms the current axis by FACTOR.
Note that this does not affect the zoom state.
ZOOM ON turns zoom on for the current figure.
ZOOM OFF turns zoom off in the current figure.
ZOOM OUT returns the plot to its initial (full) zoom.
ZOOM XON or ZOOM YON turns zoom on for the x or y axis only.
ZOOM RESET clears the zoom out point.
When zoom is on, click the left mouse button to zoom in on the
point under the mouse. Click the right mouse button to zoom out
(shiftclick on the Macintosh). Each time you click, the axes
limits will be changed by a factor of 2 (in or out). You can also
click and drag to zoom into an area. Double clicking zooms out to
the point at which zoom was first turned on for this figure. Note
that turning zoom on, then off does not reset the zoom point.
This may be done explicitly with ZOOM RESET.
ZOOM(FIG,OPTION) applies the zoom command to the figure specified
by FIG. OPTION can be any of the above arguments.
FIGURE
Create figure window.
FIGURE, by itself, creates a new figure window, and returns
its handle.
FIGURE(H) makes H the current figure, forces it to become visible,
and raises it above all other figures on the screen. If Figure H
does not exist, and H is an integer, a new figure is created with
handle H.
GCF returns the handle to the current figure.
Execute GET(H) to see a list of figure properties and
their current values. Execute SET(H) to see a list of figure
properties and their possible values.
See also SUBPLOT, AXES, GCF, CLF.
CLOSE Close
figure.
CLOSE(H) closes the window with handle H.
CLOSE, by itself, closes the current figure window.
CLOSE('name') closes the named window.
CLOSE ALL closes all the open figure windows.
CLOSE ALL HIDDEN closes hidden windows as well.
STATUS = CLOSE(...) returns 1 if the specified windows were closed
and 0 otherwise.
See also DELETE.
TEXT Text
annotation.
TEXT(X,Y,'string') adds the text in the quotes to location (X,Y)
on the current axes, where (X,Y) is in units from the current
plot. If X and Y are vectors, TEXT writes the text at all locations
given. If 'string' is an array the same number of rows as the
length of X and Y, TEXT marks each point with the corresponding row
of the 'string' array.
TEXT(X,Y,Z,'string') adds text in 3D coordinates.
TEXT returns a column vector of handles to TEXT objects, one
handle per text object. TEXT objects are children of AXES objects.
The X,Y pair (X,Y,Z triple for 3D) can be followed by
parameter/value pairs to specify additional properties of the text.
The X,Y pair (X,Y,Z triple for 3D) can be omitted entirely, and
all properties specified using parameter/value pairs.
Execute GET(H), where H is a text handle, to see a list of text
object properties and their current values. Execute SET(H) to see a
list of text object properties and legal property values.
See also XLABEL, YLABEL, ZLABEL, TITLE, GTEXT, LINE, PATCH.
LOGLOG
Loglog scale plot.
LOGLOG(...) is the same as PLOT(...), except logarithmic
scales are used for both the X and Y axes.
See also PLOT.
SEMILOGX
Semilog scale plot.
SEMILOGX(...) is the same as PLOT(...), except a
logarithmic (base 10) scale is used for the Xaxis.
See also PLOT.
SEMILOGY
Semilog scale plot.
SEMILOGY(...) is the same as PLOT(...), except a
logarithmic (base 10) scale is used for the Yaxis.
See also PLOT.
PROD Product
of elements.
For vectors, PROD(X) is the product of the elements of X. For
matrices, PROD(X) is a row vector with the product over each
column. For ND arrays, PROD(X) operates on the first
nonsingleton dimension.
PROD(X,DIM) works along the dimension DIM.
Example: If X = [0 1 2
3 4 5]
then prod(X,1) is [0 4 10] and prod(X,2) is [ 0
60]
See also SUM, CUMPROD, DIFF.
Overloaded methods
help sym/prod.m
LENGTH
Length of vector.
LENGTH(X) returns the length of vector X. It is equivalent
to MAX(SIZE(X)) for nonempty arrays and 0 for empty ones.
SIZE Size of
matrix.
D = SIZE(X), for MbyN matrix X, returns the twoelement
row vector D = [M, N] containing the number of rows and columns
in the matrix. For ND arrays, SIZE(X) returns a 1byN
vector of dimension lengths. Trailing singleton dimensions
are ignored.
[M,N] = SIZE(X) returns the number of rows and columns in
separate output variables. [M1,M2,M3,...,MN] = SIZE(X)
returns the length of the first N dimensions of X.
M = SIZE(X,DIM) returns the length of the dimension specified
by the scalar DIM. For example, SIZE(X,1) returns the number
of rows.
See also LENGTH, NDIMS.
Overloaded methods
help zpk/size.m
help tf/size.m
help ss/size.m
DET
Determinant.
DET(X) is the determinant of the square matrix X.
Use COND instead of DET to test for matrix singularity.
See also COND.
Overloaded methods
help sym/det.m
Matrix
division.
\ Backslash or left division.
A\B is the matrix division of A into B, which is roughly the
same as INV(A)*B , except it is computed in a different way.
If A is an NbyN matrix and B is a column vector with N
components, or a matrix with several such columns, then
X = A\B is the solution to the equation A*X = B computed by
Gaussian elimination. A warning message is printed if A is
badly scaled or nearly singular. A\EYE(SIZE(A)) produces the
inverse of A.
If A is an MbyN matrix with M < or > N and B is a column
vector with M components, or a matrix with several such columns,
then X = A\B is the solution in the least squares sense to the
under or overdetermined system of equations A*X = B. The
effective rank, K, of A is determined from the QR decomposition
with pivoting. A solution X is computed which has at most K
nonzero components per column. If K < N this will usually not
be the same solution as PINV(A)*B. A\EYE(SIZE(A)) produces a
generalized inverse of A.
/ Slash or right division.
B/A is the matrix division of A into B, which is roughly the
same as B*INV(A) , except it is computed in a different way.
More precisely, B/A = (A'\B')'. See \.
./ Array right division.
B./A denotes elementbyelement division. A and B
must have the same dimensions unless one is a scalar.
A scalar can be divided with anything.
.\ Array left division.
A.\B. denotes elementbyelement division. A and B
must have the same dimensions unless one is a scalar.
A scalar can be divided with anything.
EYE Identity
matrix.
EYE(N) is the NbyN identity matrix.
EYE(M,N) or EYE([M,N]) is an MbyN matrix with 1's on
the diagonal and zeros elsewhere.
EYE(SIZE(A)) is the same size as A.
See also ONES, ZEROS, RAND, RANDN.
DIAG
Diagonal matrices and diagonals of a matrix.
DIAG(V,K) when V is a vector with N components is a square matrix
of order N+ABS(K) with the elements of V on the Kth diagonal. K = 0
is the main diagonal, K > 0 is above the main diagonal and K < 0
is below the main diagonal.
DIAG(V) is the same as DIAG(V,0) and puts V on the main diagonal.
DIAG(X,K) when X is a matrix is a column vector formed from
the elements of the Kth diagonal of X.
DIAG(X) is the main diagonal of X. DIAG(DIAG(X)) is a diagonal matrix.
Example
m = 5;
diag(m:m) + diag(ones(2*m,1),1) + diag(ones(2*m,1),1)
produces a tridiagonal matrix of order 2*m+1.
See also SPDIAGS, TRIU, TRIL.
Overloaded methods
help sym/diag.m
INV Matrix
inverse.
INV(X) is the inverse of the square matrix X.
A warning message is printed if X is badly scaled or
nearly singular.
See also SLASH, PINV, COND, CONDEST, NNLS, LSCOV.
Overloaded methods
help sym/inv.m
help zpk/inv.m
help tf/inv.m
help ss/inv.m
