122
D. Rocchesso: Sound Processing
matrix product
transposed
is defined as
Av =
m
j=1
a
1,j
v
j
. . .
m
j=1
a
n,j
v
j
,
(15)
i.e., as a (column) vector whose i-th element is given by the dot product of the
i-th row by the vector v.
The product of a matrix A R
lm
by a matrix B R
mn
can be obtained
as a list of vectors, each being the product of matrix A by a column of B, and
it is a matrix C R
ln
. The product is properly defined only if the number of
column of the first matrix is equal to the number of rows of the second matrix.
In general, the order of factors can not be reversed, i.e., the matrix product is
not commutative.
Given a matrix A, the matrix A obtained by exchanging each row with the
corresponding column is called the transposed of A.
Languages such as Octave and Matlab were initially conceived as languages
for matrix manipulation. Therefore, they offer data structures and builtin op-
erators for representing and manipulating matrices. For example, a matrix
A R
23
can be represented as
A = [1, 2, 3; 4, 5, 6];
where the semicolon is used to separate one row from the following one. A col-
umn vector can be entered as
b = [1; 2; 3];
or, alternatively, we can transpose a row vector
b = [1, 2, 3]';
Given the definitions of the variables A and b, we can multiply the Matrix by
the vector and assign the result to a new vector variable c:
c = A * b
thus obtaining the result
c =
14
32
The product of a matrix A R
lm
by a matrix B R
mn
is represented
by
A * B
When we want to do element-wise operations between two or more vectors or
matrices having the same size, we just have to place a dot before the operator
symbol. For instance,
[1, 2, 3] .* [4, 5, 6]
returns the (row) vector [4 10 18] as a result.
Octave allows to operate on scalars, vectors, and matrices belonging to the
complex field, just by representing as a sum of real and imaginary parts (e.g.,
2 + 3i).
When we use Octave/Matlab to handle functions, or to draw their plot, we
usually operate on collections of points that are representative of the functions.
Next Page >>
<< Previous Page
Back to the Table of Contents