Digital Signal Processing Reference
In-Depth Information
APPENDIX
B
Vector/Matrix Operations in
M-Code
B.1
ROW AND COLUMN VECTORS
Vectors may be either row vectors or column vectors. A typical row vector in m-code might be [3 -1
2 4] or [3,-1,2, 4] (elements in a row can be separated by either commas or spaces), and would appear
conventionally as a row:
3
124
The same, notated as a column vector, would be [3,-1,2,4]' or [3; -1; 2; 4], where the semicolon
sets off different matrix rows:
3
1
2
4
Notated on paper, a row vector has one row and plural columns, whereas a column vector appears
as one column with plural rows.
B.2
VECTOR PRODUCTS
B.2.1 INNER PRODUCT
A row vector and a column vector of the same length as the row vector can be multiplied two different
ways, to yield two different results. With the row vector on the left and the column vector on the right,
=
4
3
2
1
1234
20
corresponding elements of each vector are multiplied, and all products are summed. This is called the
Inner Product . A typical computation would be
[
1 , 2 , 3 , 4
]∗[
4
;
3
;
2
;
1
]=
( 1 )( 4 )
+
( 2 )( 3 )
+
( 3 )( 2 )
+
( 4 )( 1 )
=
20
B.2.2 OUTER PRODUCT
An Outer Product results from placing the column vector on the left, and the row vector on the right:
Search WWH ::




Custom Search