Graphics Reference
In-Depth Information
It would define an array variable of dimension (M x N) similarly. Once a matrix variable has been defined,
MATLAB enables many options to insert, extract, renumber, and generally manipulate its elements. The following
table shows different possibilities of definition of matrix variables.
A(m,n)
Defines the (m, n) element of the matrix A (row m and column n)
A(a:b,c:d)
Defines the subarray of A formed by rows between the a-th and the b-th and the columns
between the c-th and the d-th
A(a:p:b,c:q:d)
Defines the subarray of A formed by the rows between the a-th and the b-th spaced by p in
p, and the columns between the c-th and the d-th spaced by q in q
A([a b],[c d])
Defines the subarray of A formed by the intersection of the rows a-th and the b-th and
columns c-th and the d-th
A([a b c…],)
([e f g…])
Defines the subarray of A formed by the intersection of rows a, b, c,… and columns e, f, g,…
A(:,c:d)
Defines the subarray of A formed by all the rows from A and columns between the c-th and
the d-th
A(:,[c d e…])
Defines the subarray of A formed by all the rows from A and columns c, d, e,…
A(a:b,:)
Defines the subarray of A formed by all the columns in A and rows between the a-th and
the b-th
A([a b c…],:)
Defines the subarray of A formed by all the columns in A and rows a, b, c,…
A(a,:)
Defines the a-th row of the matrix A
A(:,b)
Defines the b-th column of the matrix A
A (:)
Defines a vector column whose elements are the columns of A placed one below another
A(:,:)
It is equivalent to all of the matrix A
[A, B, C,…]
Defines the matrix formed by the XCF of A, B, C,…
SA = [ ]
Clears the subarray of the matrix A, SA , and returns the remainder
diag (v)
Creates a diagonal matrix with the vector v in the diagonal
diag (A)
Extracts the diagonal of the matrix as a vector column
eye (n)
It creates the identity matrix of order n
eye (m, n)
Creates and order m x n matrix with ones on the main diagonal and zeros elsewhere
zeros (m, n)
Creates the zero matrix of order m x n
ones (m, n)
Creates the matrix of order m x n with all its elements 1
rand (m, n)
It creates a uniform random matrix of order m x n
randn (m, n)
Creates a normal random matrix of order m x n
flipud (A)
Returns the matrix whose rows are placed in reverse order (from top to bottom)
of the rows of A
fliplr (A)
Returns the matrix whose columns are placed in reverse (from left to right)
of the columns of a
( continued )
Search WWH ::




Custom Search