| Signal Processing Blockset™ | ![]() |
Multiply matrix elements along rows, columns, or entire input
Math Functions / Matrices and Linear Algebra / Matrix Operations
dspmtrx3

The Matrix Product block multiplies the elements of an M-by-N input matrix u along its rows, its columns, or over all its elements.
When the Multiply over parameter is set to Rows, the block multiplies across the elements of each row and outputs the resulting M-by-1 matrix. A length-N 1-D vector input is treated as a 1-by-N matrix.

When the Multiply over parameter is set to Columns, the block multiplies down the elements of each column and outputs the resulting 1-by-N matrix. A length-M 1-D vector input is treated as a M-by-1 matrix.

When the Multiply over parameter is set to Entire input, the block multiplies all the elements of the input together and outputs the resulting scalar.

The output of the Matrix Product block has the same frame status as the input. This block accepts real and complex fixed-point and floating-point inputs except for complex unsigned fixed-point inputs.
The following diagram shows the data types used within the Matrix Product block for fixed-point signals.

The output of the multiplier is in the product output data type when at least one of the inputs to the multiplier is real. When both of the inputs to the multiplier are complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types. You can set the accumulator, product output, intermediate product, and output data types in the block dialog as discussed in Dialog Box below.
The Main pane of the Matrix Product block dialog appears as follows.

Indicate whether to multiply together the elements of each row, each column, or the entire input.
The Fixed-point pane of the Matrix Product block dialog appears as follows.

Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
As shown in Fixed-Point Data Types, the output of the multiplier is cast to the intermediate product data type before the next element of the input is multiplied into it. Use this parameter to specify how you would like to designate the intermediate product word and fraction lengths:
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the intermediate product, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the intermediate product. This block requires power-of-two slope and a bias of zero.
Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block:
When you select Inherit via internal rule, the product output word length and fraction length are calculated automatically. For information about how the product output word and fraction lengths are calculated when an internal rule is used, see Inherit via Internal Rule.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of zero.
Use this parameter to specify how you would like to designate the accumulator word and fraction lengths. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the accumulator data type in this block. Note that the accumulator data type is only used when both inputs to the multiplier are complex:
When you select Inherit via internal rule, the accumulator word length and fraction length are calculated automatically. For information about how the accumulator word and fraction lengths are calculated when an internal rule is used, see Inherit via Internal Rule.
When you select Same as product output, these characteristics match those of the product output.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of zero.
Choose how you specify the word length and fraction length of the output of the block:
When you select Same as product output, these characteristics match those of the product output.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of zero.
Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling feature of the Fixed-Point Tool. See the fxptdlg reference page for more information.
Port | Supported Data Types |
|---|---|
Input |
|
Output |
|
| Array-Vector Multiply | Signal Processing Blockset |
| Matrix Square | Signal Processing Blockset |
| Matrix Sum | Signal Processing Blockset |
| prod | MATLAB |
![]() | Matrix Multiply | Matrix Square | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |