; % !
[ ] ( ) = '
. , ; % !
[ ]
[6.9 9.64 sqrt(-1)]
is a vector with three elements separated by blanks. [6.9, 9.64, i]
is the same thing. [1+j 2-j 3]
and [1 +j 2
-j 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.[ ]
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
.[
and ]
on the left of an "=
" in multiple assignment statements, see lu
, eig
, svd
, and so on.( )
X
and V
are vectors, then X(V)
is [X(V(1)), X(V(2)), ..., X(V(n))]
. The components of V
are rounded to nearest integers and used as subscripts. An error occurs if any such subscript is less than 1
or greater than the dimension of X
. Some examples are
X(3)
is the third element of X
.X([1 2 3])
is the first three elements of X
. X([sqrt(2) sqrt(3) 4*atan(1)])
is also the first three elements of X
.X
has n
components, X(n:
-1:1)
reverses them. The same indirect subscripting works in matrices. 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
.=
==
is the relational EQUALS operator. See the Relational Operators page.
'
X'
is the complex conjugate transpose of X
. X.'
is the nonconjugate transpose.
'any text'
is a vector whose components are the ASCII codes for the characters. A quote within the text is indicated by two quotes..
314/100
, 3.14
and .314e1
are all the same.
.*
,
.^ , ./
, or .\
. See the Arithmetic Operators page.,
;
%
!
(c) Copyright 1994 by The MathWorks, Inc.