Environmental Engineering Reference
In-Depth Information
How matrices containing a constant, different from 0 and 1, can be obtained
easily, is demonstrated by the following command:
The ones -matrix is multiplied by a single value, a so called scalar , here 4.5.
The * stands for multiplication. As will be explained in more details in the next
Section, there are several multiplication operations in linear algebra and in
MATLAB
. In the previous command line the * stands for scalar multiplication ,
where all elements of the matrix are multiplied by the same scalar value.
The command for random matrices is
®
Random values between 0 and 1 are entries of the matrix. If there is only one
integer argument in the preceding matrix types, a square matrix results:
As mentioned above matrices are 2-dimensional arrays. Single numbers can be
regarded as 1-dimensional arrays. MATLAB
can, of course, handle arrays of
higher dimensions. We demonstrate this by introducing the randn command:
®
which is a 3-dimensional array of random numbers with mean value
m ¼
0and
standard deviation
1. In the same manner, all previous matrix generating
commands can be applied to obtain higher dimensional arrays if the number of
arguments in the call exceeds 2. Multi-dimensional arrays can be viewed using the
array editor, but they cannot be edited within the editor. In order to do this,
s ¼
Search WWH ::




Custom Search