Environmental Engineering Reference
In-Depth Information
user will usually
use the / -operator for the same expression: B/A . However, the division procedure is
not unique, because matrix multiplication does not have the commutation property
to which we are used to from calculating with single numbers (see exercise below).
There are two types of divisions depending on the order in which the product is
performed. The / operator has to be used if A 1 is the second operator; if A 1 is the
first operator, the \ (backslash) is necessary.
Example in MATLAB: instead of the expression inv(A)*B one may use:
X is the solution of the linear system XA
¼
B. The MATLAB
®
Y is the solution of the linear system A X ¼ B. One speaks of left-division for
the latter case and of right-division' in the former case. Both division operators can
also be used for non-square matrices (see Sidebar 1.1).
The power operation is defined for matrices as well. There is a power operator
for matrix multiplication and another for pointwise operation. In MATLAB
these
are written by ^ for matrix multiplication and .^ for pointwise multiplication. In
formulae the power notation is used for matrix multiplication.
Example in MATLAB
®
:
®
It was already mentioned that matrices can be multiplied by a single number, by
a so-called scalar. The scalar multiplication is demonstrated by the example:
All elements of the matrix are multiplied by the scalar. Note that in MATLAB
®
the * is also used for scalar multiplication. MATLAB
distinguishes between
scalar multiplication and standard matrix multiplication automatically (both are
written by the same * operator). The type of the operands gives the unique clue
which of both operations is meant. From the dimension of the operators the program
finds out, whether matrix or scalar multiplication is meant. In formulae we will
usually use no symbol to indicate scalar multiplication. Sometimes we use the '
®
'in
formulae in order to separate the factors.
Search WWH ::




Custom Search