Getting Started |
Scalar Expansion
Matrices and scalars can be combined in several different ways. For example, a scalar is subtracted from a matrix by subtracting it from each element. The average value of the elements in our magic square is 8.5, so
forms a matrix whose column sums are zero:
With scalar expansion, MATLAB assigns a specified scalar to all indices in a range. For example,
Multivariate Data | Logical Subscripting |
© 1994-2005 The MathWorks, Inc.