Getting Started Previous page   Next Page

Arrays

When they are taken away from the world of linear algebra, matrices become two-dimensional numeric arrays. Arithmetic operations on arrays are done element by element. This means that addition and subtraction are the same for arrays and matrices, but that multiplicative operations are different. MATLAB uses a dot, or decimal point, as part of the notation for multiplicative array operations.

The list of operators includes

+   
Addition
-   
Subtraction
.*
Element-by-element multiplication
./
Element-by-element division
.\
Element-by-element left division
.^
Element-by-element power
.'  
Unconjugated array transpose

If the Dürer magic square is multiplied by itself with array multiplication

the result is an array containing the squares of the integers from 1 to 16, in an unusual order:

Building Tables

Array operations are useful for building tables. Suppose n is the column vector

Then

builds a table of squares and powers of 2:

The elementary math functions operate on arrays element by element. So

builds a table of logarithms.


Previous page  More About Matrices and Arrays Multivariate Data Next page

© 1994-2005 The MathWorks, Inc.