Difference between revisions of "Matlab Arrays"
(→Array Basics) |
m (→Array Basics) |
||
Line 24: | Line 24: | ||
</math> | </math> | ||
</center> | </center> | ||
− | is a matrix with three rows and two columns. We refer to this as a <math>\ | + | is a matrix with three rows and two columns. We refer to this as a <math>\scriptstyle 3 \times 2</math> matrix. The first index is the row and the second index is the column. |
=== Transposing Arrays === | === Transposing Arrays === |
Revision as of 07:25, 29 July 2008
Array Basics
An array is an n-dimensional collection of numbers. Matrices are 2-dimensional arrays, and vectors are 1-dimensional arrays.
Vectors can be either a row or column vector:
We refer to the elements of an array by their position in the array. For example, the third element in is 3.2, and the second element in is .
Matrices are two-dimensional arrays, whose elements are referred to by the row and column that they belong to. For example,
is a matrix with three rows and two columns. We refer to this as a matrix. The first index is the row and the second index is the column.
Transposing Arrays
Occasionally we want to transpose an array. This is done by exchanging rows and columns. For example,
Here the superscript indicates transpose. Note that if we transpose an array twice, we recover the original array. In other words, .