Matrix Product
Multiply matrix elements along rows, columns, or entire input
Libraries:
DSP System Toolbox /
Math Functions /
Matrices and Linear Algebra /
Matrix Operations
Description
The Matrix Product block multiplies the elements of an MbyN input matrix along its rows, columns, or over all its elements.
Ports
Input
Input — Input
vector  matrix
Specify the input as a vector or a matrix of size MbyN.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 fixed point
Complex Number Support: Yes
Output
Output — Matrix product output
vector  matrix
Output of the Matrix Product block, returned as a vector or a matrix. For more information on how the block computes the output, see the description for the Multiply over parameter.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 fixed point
Complex Number Support: Yes
Parameters
Main Tab
Multiply over — Dimension over which to multiply
Columns
(default)  Rows
 Entire input
Specify the dimension over which to multiply as one of these:
Columns
–– The block multiplies down the elements of each column and outputs the resulting 1byN matrix. The block treats lengthM unoriented vector input as an Mby1 matrix.$$\begin{array}{ccc}\left[\begin{array}{ccc}{u}_{11}& {u}_{12}& {u}_{13}\\ {u}_{21}& {u}_{22}& {u}_{23}\\ {u}_{31}& {u}_{32}& {u}_{33}\end{array}\right]& & \\ \Downarrow & & \\ \left[\begin{array}{ccc}{y}_{1}& {y}_{2}& {y}_{3}\end{array}\right]& =& \left[\begin{array}{ccc}\left({\displaystyle \prod _{i=1}^{3}{u}_{i1}}\right)& \left({\displaystyle \prod _{i=1}^{3}{u}_{i2}}\right)& \left({\displaystyle \prod _{i=1}^{3}{u}_{i3}}\right)\end{array}\right]\end{array}$$
Rows
–– The block multiplies across the elements of each row and outputs the resulting Mby1 matrix. The block treats lengthN unoriented vector input as a 1byN matrix.$$\left[\begin{array}{ccc}{u}_{11}& {u}_{12}& {u}_{13}\\ {u}_{21}& {u}_{22}& {u}_{23}\\ {u}_{31}& {u}_{32}& {u}_{33}\end{array}\right]\Rightarrow \left[\begin{array}{c}{y}_{1}\\ {y}_{2}\\ {y}_{3}\end{array}\right]=\left[\begin{array}{c}\left({\displaystyle \prod _{j=1}^{3}{u}_{1j}}\right)\\ \left({\displaystyle \prod _{j=1}^{3}{u}_{2j}}\right)\\ \left({\displaystyle \prod _{j=1}^{3}{u}_{3j}}\right)\end{array}\right]$$
Entire input
–– The block multiplies all the elements of the input together and outputs the resulting scalar.$$\left[\begin{array}{ccc}{u}_{11}& {u}_{12}& {u}_{13}\\ {u}_{21}& {u}_{22}& {u}_{23}\\ {u}_{31}& {u}_{32}& {u}_{33}\end{array}\right]\Rightarrow y=({\displaystyle \prod _{i=1}^{3}{\displaystyle \prod _{j=1}^{3}{u}_{ij}}})$$
Data Types Tab
Note
Floatingpoint inheritance takes precedence over the data type settings defined on this pane. When inputs are floating point, the block ignores these settings, and all internal data types are floating point.
Rounding mode — Rounding mode
Floor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Simplest
 Zero
Specify the rounding mode for fixedpoint operations as one of the following:
Floor
Ceiling
Convergent
Nearest
Round
Simplest
Zero
For more details, see rounding mode.
Saturate on integer overflow — Saturate on integer overflow
off
(default)  on
When you select this parameter, the block saturates the result of its
fixedpoint operation. When you clear this parameter, the block wraps
the result of its fixedpoint operation. For details on
saturate
and wrap
, see overflow
mode for fixedpoint operations.
Intermediate product — Intermediate product data type
Inherit: Same as
input
(default)  fixdt([],16,0)
Specify the intermediate product data type. As shown in FixedPoint 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. You can set it to:
A rule that inherits a data type, for example,
Inherit: Same as input
An expression that evaluates to a valid data type, for example,
fixdt([],16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output parameter.
See Specify Data Types Using Data Type Assistant (Simulink) for more information.
Product output — Product output data type
Inherit: Inherit via internal
rule
(default)  Inherit: Same as input
 fixdt([],16,0)
Specify the product output data type. See FixedPoint Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:
A rule that inherits a data type, for example,
Inherit: Inherit via internal rule
. For more information on this rule, see Inherit via Internal Rule.A rule that inherits a data type, for example,
Inherit: Same as input
.An expression that evaluates to a valid data type, for example,
fixdt([],16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output parameter.
See Specify Data Types Using Data Type Assistant (Simulink) for more information.
Accumulator — Accumulator data type
Inherit: Inherit via internal
rule
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt([],16,0)
Specify the accumulator data type. See FixedPoint Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:
A rule that inherits a data type, for example,
Inherit: Inherit via internal rule
. For more information on this rule, see Inherit via Internal Rule.A rule that inherits a data type, for example,
Inherit: Same as input
.A rule that inherits a data type, for example,
Inherit: Same as product output
.An expression that evaluates to a valid data type, for example,
fixdt([],16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator parameter.
See Specify Data Types Using Data Type Assistant (Simulink) for more information.
Output — Output data type
Inherit: Same as product
output
(default)  Inherit: Same as input
 fixdt([],16,0)
Specify the output data type. See FixedPoint Data Types for illustrations depicting the use of the output data type in this block. You can set it to:
A rule that inherits a data type, for example,
Inherit: Same as product output
A rule that inherits a data type, for example,
Inherit: Same as input
.An expression that evaluates to a valid data type, for example,
fixdt([],16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output parameter.
See Control Data Types of Signals (Simulink) for more information.
Output Minimum — Output minimum
[]
(default)  scalar
Specify the minimum value that the block should output. The default
value is []
(unspecified). Simulink^{®} uses this value to perform:
Simulation range checking (see Specify Signal Ranges (Simulink))
Automatic scaling of fixedpoint data types
Output Maximum — Output maximum
[]
(default)  scalar
Specify the maximum value that the block should output. The default
value is []
(unspecified). Simulink uses this value to perform:
Simulation range checking (see Specify Signal Ranges (Simulink))
Automatic scaling of fixedpoint data types
Lock data type settings against changes by the fixedpoint tools — Prevent fixedpoint tools from overriding data types
off
(default)  on
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify in the block dialog box.
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

More About
FixedPoint Data Types
The following diagram shows the data types used within the Matrix Product block for fixedpoint 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 box.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Generated code relies on the memcpy
or
memset
function (string.h
) under certain
conditions.
FixedPoint Conversion
Design and simulate fixedpoint systems using FixedPoint Designer™.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)