+ Plus.
X + Y adds matrices X and Y. X and Y must have the same
dimensions unless one is a scalar (a 1-by-1 matrix).
A scalar can be added to anything.

C = PLUS(A,B) is called for the syntax 'A + B' when A or B is an

Overloaded methods
help sym/plus.m
help zpk/plus.m
help tf/plus.m
help ss/plus.m

- Minus.
X - Y subtracts matrix Y from X. X and Y must have the same
dimensions unless one is a scalar. A scalar can be subtracted
from anything.

C = MINUS(A,B) is called for the syntax 'A - B' when A or B is an

Overloaded methods
help sym/minus.m
help zpk/minus.m
help tf/minus.m
help ss/minus.m

* Matrix multiply.
X*Y is the matrix product of X and Y. Any scalar (a 1-by-1 matrix)
may multiply anything. Otherwise, the number of columns of X must
equal the number of rows of Y.

C = MTIMES(A,B) is called for the syntax 'A * B' when A or B is an

See also TIMES.

Overloaded methods
help sym/mtimes.m
help zpk/mtimes.m
help tf/mtimes.m
help ss/mtimes.m

.* Array multiply.
X.*Y denotes element-by-element multiplication. X and Y
must have the same dimensions unless one is a scalar.
A scalar can be multiplied into anything.

C = TIMES(A,B) is called for the syntax 'A .* B' when A or B is an

See also MTIMES.

Overloaded methods
help sym/times.m

^ Matrix power.
Z = X^y is X to the y power if y is a scalar and X is square. If y is an
integer greater than one, the power is computed by repeated
multiplication. For other values of y the calculation
involves eigenvalues and eigenvectors.
Z = x^Y is x to the Y power, if Y is a square matrix and x is a scalar,
computed using eigenvalues and eigenvectors.
Z = X^Y, where both X and Y are matrices, is an error.

C = MPOWER(A,B) is called for the syntax 'A ^ B' when A or B is an

See also POWER.

Overloaded methods
help sym/mpower.m

.^ Array power.
Z = X.^Y denotes element-by-element powers. X and Y
must have the same dimensions unless one is a scalar.
A scalar can operate into anything.

C = POWER(A,B) is called for the syntax 'A .^ B' when A or B is an

See also MPOWER.

Overloaded methods
help sym/power.m

: Colon.
J:K is the same as [J, J+1, ..., K].
J:K is empty if J > K.
J:D:K is the same as [J, J+D, ..., J+m*D] where m = fix((K-J)/D).
J:D:K is empty if D > 0 and J > K or if D < 0 and J < K.

COLON(J,K) is the same as J:K and COLON(J,D,K) is the same as J:D:K.

The colon notation can be used to pick out selected rows, columns
and elements of vectors, matrices, and arrays. A(:) is all the
elements of A, regarded as a single column. On the left side of an
assignment statement, A(:) fills A, preserving its shape from before.
A(:,J) is the J-th column of A. A(J:K) is [A(J);A(J+1);...;A(K)].
A(:,J:K) is [A(:,J),A(:,J+1),...,A(:,K)] and so on.

The colon notation can be used with a cell array to produce a comma-
separated list. C{:} is the same as C{1},C{2},...,C{end}. The comma
separated list syntax is valid inside () for function calls, [] for
concatenation and function return arguments, and inside {} to produce
a cell array. Expressions such as S(:).name produce the comma separated
list S(1).name,S(2).name,...,S(end).name for the structure S.

For the use of the colon in the FOR statement, See FOR.
For the use of the colon in a comma separated list, See VARARGIN.

Overloaded methods
help sym/colon.m

Parentheses, braces, and brackets.
( ) Parentheses are used to indicate precedence in arithmetic
expressions and to enclose arguments of functions in the usual
way. They are used to enclose subscripts of vectors and matrices
in a manner somewhat more general than the usual way. If X and V
are vectors, then X(V) is [X(V(1)), X(V(2)), ..., X(V(N))]. The
components of V must be integers and are used as subscripts. An
error occurs if any such subscript is less than 1 or greater
than the dimension of X.

Parenthesis can also enclose logical (or 0-1) subscripts.
If V is logical, the non-zero elements of V define a mask into the
array X. Logical arrays are produced by the relational and logical
operators or by the LOGICAL command. Parenthess are supported by all
the MATLAB data types including the traditional double precision
arrays as well as the structure, cell, and character arrays.

Some examples:
X(3) is the third element of X.
X([1 2 3]) is the first three elements of X.
If X has N components, X(N:-1:1) reverses them.
X(X>0.5) returns those elements of X that are > 0.5.

The same indirect subscripting is used in matrices and arrays.
If V has M components and W has N components, then A(V,W) is the
M-by-N matrix formed from the elements of A whose subscripts are
the elements of V and W. For example, A([1,5],:) = A([5,1],:)
interchanges rows 1 and 5 of A.

{ } Braces are used to form cell arrays. They are similar to
brackets [ ] except that nesting levels are preserved.
{magic(3) 6.9 'hello'} is a cell array with three elements.
{magic(3),6.9,'hello'} is the same thing.
{'This' 'is' 'a';'two' 'row' 'cell'} is a 2-by-3 cell array.
The semicolon ends the first row. {1 {2 3} 4} is a 3 element
cell array where element 2 is itself a cell array.

Braces are also used for content addressing of cell arrays.
They act similar to parentheses in this case except that the
contents of the cell is returned.

Some examples:
X{3} is the contents of the third element of X.
X{3}(4,5) is the (4,5) element of those contents.
X{[1 2 3])} is a comma separated list of the first three
elements of X. It is the same as X{1},X{2},X{3} and makes sense
inside [] ,{}, or in function input or output lists (see LISTS).

You can repeat the content addressing for nested cells so
that X{1}{2} is the contents of the second element of the cell
inside the first cell of X. This also works for nested
structures, as in X(2).field(3).name or combinations of cell arrays
and structures, as in Z{2}.type(3).

[ ] Brackets are used in forming vectors and matrices.
[6.9 9.64 SQRT(-1)] is a vector with three elements
separated by blanks. [6.9, 9.64, sqrt(-1)] is the same
thing. [1+I 2-I 3] and [1 +I 2 -I 3] are not the same.
The first has three elements, the second has five.
[11 12 13; 21 22 23] is a 2-by-3 matrix. The semicolon
ends the first row.

Vectors and matrices can be concatenated with [ ] brackets.
[A B; C] is allowed if the number of rows of A equals
the number of rows of B and the number of columns of A
plus the number of columns of B equals the number of
columns of C. This rule generalizes in a hopefully
obvious way to allow fairly complicated constructions.
A = [] stores an empty matrix in A. See CLEAR to remove
variables from the current workspace.
For the use of [ and ] on the left of the = in multiple
assignment statements, see LU, EIG, SVD and so on.


. Decimal point. 325/100, 3.25 and .325e1 are all the same.

. Array operations. Element-by-element multiplicative operations
are obtained using .* , .^ , ./ , .\ or .'. For example,
C = A ./ B is the matrix with elements c(i,j) = a(i,j)/b(i,j).

. Field access. A.field and A(i).field, when A is a structure, access
the contents of the field with the name "field". If A isn't a
scalar structure, this produces a comma separated list (see LISTS).
You can nest structure access as in X(2).field(3).name. You can
also combine structure, cell array, and paren subscripting if that
makes sense for the arrays stored in the structure (see PAREN).

.. Parent directory. See CD.

... Continuation. Three or more decimal points at the end of
a line causes the following line to be a continuation.

, Comma. The comma is used to separate matrix subscripts
and arguments to functions. It is also used to separate
statements in multi-statement lines. In this situation,
it may be replaced by a semicolon to suppress printing.

; Semicolon. The semicolon is used inside brackets to indicate
the ends of the rows of a matrix. It is also used after an
expression or statement to suppress printing.

% Percent. The percent symbol is used to begin comments.
Logically, it serves as an end-of-line character. Any
following text on the line is ignored or printed by the
HELP system.

! Exclamation point. Any text following the '!' is issued
as a command to the underlying computer operating system.
On the PC, adding & to the end of the ! command line, as in
!dir &
causes the output to appear in a separate window and for the window
to remain open after the command completes.

' Transpose. X' is the complex conjugate transpose of X.
X.' is the non-conjugate transpose.

' Quote. 'ANY TEXT' is a vector whose components are the
ASCII codes for the characters. A quote within the text
is indicated by two quotes. For example: 'Don''t forget.'

= Assignment. B = A stores the elements of A in B.


PLOT Linear plot.
PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix,
then the vector is plotted versus the rows or columns of the matrix,
whichever line up.

PLOT(Y) plots the columns of Y versus their index.
If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
In all other uses of PLOT, the imaginary part is ignored.

Various line types, plot symbols and colors may be obtained with
PLOT(X,Y,S) where S is a character string made from one element
from any or all the following 3 colunms:

y yellow . point - solid
m magenta o circle : dotted
c cyan x x-mark -. dashdot
r red + plus -- dashed
g green * star
b blue s square
w white d diamond
k black v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram

For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus
at each data point; PLOT(X,Y,'bd') plots blue diamond at each data
point but does not draw any line.

PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by
the (X,Y,S) triples, where the X's and Y's are vectors or matrices
and the S's are strings.

For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a
solid yellow line interpolating green circles at the data points.

The PLOT command, if no color is specified, makes automatic use of
the colors specified by the axes ColorOrder property. The default
ColorOrder is listed in the table above for color systems where the
default is yellow for one line, and for multiple lines, to cycle
through the first six colors in the table. For monochrome systems,
PLOT cycles over the axes LineStyleOrder property.

PLOT returns a column vector of handles to LINE objects, one
handle per line.

The X,Y pairs, or X,Y,S triples, can be followed by
parameter/value pairs to specify additional properties
of the lines.


XLABEL X-axis label.
XLABEL('text') adds text beside the X-axis on the current axis.

sets the values of the specified properties of the xlabel.

H = XLABEL(...) returns the handle to the text object used as the label.


YLABEL Y-axis label.
YLABEL('text') adds text beside the Y-axis on the current axis.

sets the values of the specified properties of the ylabel.

H = YLABEL(...) returns the handle to the text object used as the label.


ZLABEL Z-axis label.
ZLABEL('text') adds text above the Z-axis on the current axis.

sets the values of the specified properties of the zlabel.

H = ZLABEL(...) returns the handle to the text object used as the label.


TITLE Graph title.
TITLE('text') adds text at the top of the current axis.

sets the values of the specified properties of the title.

H = TITLE(...) returns the handle to the text object used as the title.


GRID Grid lines.
GRID ON adds grid lines to the current axes.
GRID OFF takes them off.
GRID, by itself, toggles the grid state.

GRID sets the XGrid, YGrid, and ZGrid properties of
the current axes.