Page 367 - Process Modelling and Simulation With Finite Element Methods
P. 367
354 Process Modelling and Simulation with Finite Element Methods
In the case of vectors, the matrix (ab)ik is called the dyadic product of a and b, or
a dyad. It is a special case of the matrix outer product, where the scalar product
is also termed the inner product.
The scalar product of two row vectors or two column vectors can be
computed in MATLAB using the transpose operator ', which is a unary operator
and deceptively easy to mistake as a single quote of a character string, for
instance.
>> a=[l; 2; 31; b=[-3; 2; -11; b'*a
ans =
-2
but
>> a*b'
ans =
-3 2 -1
-6 4 -2
-9 6 -3
still yields the dyad. Care must still be taken to respect the matrix compatibility.
If a and b were row vectors, which combination, b' *a or a*b' yields the inner
and outer products? MATLAB provides a special function dot for this purpose
that blurs the distinction about compatibility:
>> help dot
DOT Vector dot product.
C = DOT(A,B) returns the scalar product of the vectors A and B.
A and B must be vectors of the same length. When A and B are both
column vectors, DOT(A,B) is the same as A'*B.
DOT(A,B), for N-D arrays A and B, returns the scalar product
along the first non-singleton dimension of A and B. A and B must
have the same size.
DOT(A,B,DIM) returns the scalar product of A and B in the
dimension DIM.
See also CROSS.
Example.
> dot(a,b)
ans =
-2
>> dot( [l; 2; 31, [-3 2 -11)
ans =
-2
It simply does not matter with dot which combination of rowkolumn vectors is
used.