| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Math Operations

By default, the Product block outputs the result of multiplying two inputs: two scalars, a scalar and a nonscalar, or two nonscalars that have the same dimensions. The default parameter values that specify this behavior are:
Multiplication: Element-wise(.*)
Number of inputs: 2
Setting non-default values for either of these parameters can change a Product block to function as a Divide block or a Product of Elements block. See the documentation of those two blocks for more information.
If all you need is to multiply two inputs to create an output, you can use the Product block with default parameter values. If you need additional capabilities, see Product Block Capabilities.
The following table shows the output of the Product block for some typical inputs using default block parameter values.
| Inputs and Behavior | Example |
|---|---|
Scalar X Scalar Output the product of the two inputs. |
|
Scalar X Nonscalar Output a nonscalar having the same dimensions as the input nonscalar. Each element of the output nonscalar is the product of the input scalar and the corresponding element of the input nonscalar. |
|
Nonscalar X Nonscalar Output a nonscalar having the same dimensions as the inputs. Each element of the output is the product of corresponding elements of the inputs. |
|
The Product block, the Divide block, and the Product of Elements block are actually the same underlying block with different default values for the Number of inputs parameter. All three blocks can therefore provide the same capabilities. The Product block (or the Divide block or Product of Elements block if appropriately configured) can:
Numerically multiply and divide any number of scalar, vector, or matrix inputs
Perform matrix multiplication and division on any number of matrix inputs
The Product block performs scalar or matrix multiplication, depending on the value of the Multiplication parameter. The block accepts one or more inputs, depending on the Number of inputs parameter. The Number of inputs parameter also specifies the operation to perform on each input.
The Product block can input any combination of scalars, vectors, and matrices for which the operation to perform has a mathematically defined result. The block performs the specified operations on the inputs, then outputs the result.
The Product block has two modes: Element-wise mode, which processes nonscalar inputs element by element, and Matrix mode, which processes nonscalar inputs as matrices. The next two sections describe these two modes.
When the value of the Multiplication parameter is Element-wise(.*), the Product block is in Element-wise mode, in which it operates on the individual numeric elements of any nonscalar inputs. The MATLAB equivalent is the .* operator. In element-wise mode, the Product block can perform a variety of multiplication, division, and arithmetic inversion operations.
The value of the Number of inputs parameter controls both how many inputs exist and whether each is multiplied or divided to form the output. When the Product block in Element-wise mode has only one input, it is functionally equivalent to a Product of Elements block. When the block has multiple inputs, any nonscalar inputs must have identical dimensions, and the block outputs a nonscalar with those dimensions. To calculate the output, the block first expands any scalar input to a nonscalar that has the same dimensions as the nonscalar inputs.
This table shows the output of the Product block for some typical inputs, using the indicated values for the Number of inputs parameter.
| Parameter Values | Examples |
|---|---|
Number of inputs: 2 |
|
Number of inputs: */ |
|
Number of inputs: /**/ |
|
Number of inputs: ** |
|
Number of inputs: */* |
|
When the value of the Multiplication parameter is Matrix(*), the Product block is in Matrix mode, in which it processes nonscalar inputs as matrices. The MATLAB equivalent is the * operator. In Matrix mode, the Product block can invert a single square matrix, or multiply and divide any number of matrices that have dimensions for which the result is mathematically defined.
The value of the Number of inputs parameter controls both how many inputs exist and whether each input matrix is multiplied or divided to form the output. The syntax of Number of inputs is the same as in Element-wise mode. The difference between the modes is in the type of multiplication and division that occur.
The Product block accepts real or complex signals of any numeric data type supported by Simulink software including fixed-point data types. For a discussion of the data types supported by Simulink software, see Data Types Supported by Simulink.
The Product block does not support numeric division for complex signals with boolean or fixed-point data types. For other types, the block accepts complex signals as divisors only when the input and output signals all specify the same built-in data type. In this case, however, the block ignores its specified rounding mode.
The Product block accepts multidimensional signals when operating in Element-wise mode, but not when operating in Matrix mode. See Signal Dimensions, Element-wise Mode, and Matrix Mode for more information.
The Main pane of the Product block dialog box appears as follows:

The Signal Attributes pane of the Product block dialog box appears as follows:

Display the Data Type Assistant.
The Data Type Assistant helps you set the Output data type parameter.
See Specifying Block Output Data Types for more information.
See Block-Specific Parameters for the command-line information.
Control two properties of the Product block:
The number of input ports on the block
Whether each input is multiplied or divided into the output
Default:2
1 or * or /
Has one input. In Element-wise mode, the input is processed as described for the Product of Elements block. In Matrix mode, if the parameter value is 1 or * the block outputs the input value. If the value is / the input must be a square matrix (including a scalar as a degenerate case) and the block outputs the matrix inverse. See Element-wise Mode and Matrix Mode for more information.
An integer value > 1
Has number of inputs given by the integer value. The inputs are multiplied together in Element-wise mode or Matrix mode, as specified by the Multiplication parameter. See Element-wise Mode and Matrix Mode for more information.
An unquoted string of two or more * and / characters
Has the number of inputs given by the length of the string. Each input that corresponds to a * character is multiplied into the output. Each input that corresponds to a / character is divided into the output. The operations occur in Element-wise mode or Matrix mode, as specified by the Multiplication parameter. See Element-wise Mode and Matrix Mode for more information.
Setting Number of inputs to * and selecting Element-wise(.*) for Multiplication enable the following parameter:
Multiply over
See Block-Specific Parameters for the command-line information.
Specify whether the Product block operates in Element-wise mode or Matrix mode.
Default: Element-wise(.*)
Selecting Element-wise(.*) and setting Number of inputs to * enable the following parameter:
Multiply over
See Block-Specific Parameters for the command-line information.
Affect multiplication on matrix input.
Default: All dimensions
Output a scalar that is product of all elements of the matrix, or the product of their inverses, depending on the value of Number of inputs.
Output a vector, the composition of which depends on the value of the Dimension parameter.
Enable this parameter by selecting Element-wise(.*) for Multiplication and setting Number of inputs to * or 1 or /.
Setting this parameter to Specified dimension enables the Dimension parameter.
See Block-Specific Parameters for the command-line information.
Affect multiplication on matrix input.
Default: 1
Minimum: 1
Maximum: 2
Output a vector that contains an element for each column of the input matrix.
Output a vector that contains an element for each row of the input matrix.
Each element of the output vector contains the product of all elements in the corresponding column or row of the input matrix, or the product of the inverses of those elements, depending on the value of Number of inputs:
1 or *
Multiply the values of the column or row elements
/
Multiply the inverses of the column or row elements
Enable this parameter by selecting Specified dimension for Multiply over.
See Block-Specific Parameters for the command-line information.
Enter the discrete interval between sample time hits or specify another appropriate sample time such as continuous or inherited.
Default: -1
By default, the block inherits its sample time based upon the context of the block within the model. To set a different sample time, enter a valid sample time based upon the table in Types of Sample Time.
See also How to Specify the Sample Time in the online documentation for more information.
See Block-Specific Parameters for the command-line information.
Require that all inputs have the same data type.
Default: Off
Require that all inputs have the same data type.
Do not require that all inputs have the same data type.
See Block-Specific Parameters for the command-line information.
Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.
Default: Off
Locks the output data type setting for this block.
Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.
See Block-Specific Parameters for the command-line information.
For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.
Select the rounding mode for fixed-point operations.
Default: Zero
Round both positive and negative numbers toward positive infinity.
Round number to the nearest representable value. If a tie occurs, round to the nearest even stored value.
Round both positive and negative numbers toward negative infinity.
Round number to the nearest representable value. If a tie occurs, round toward positive infinity.
Round number to the nearest representable value. If a tie occurs, round positive numbers toward positive infinity and round negative numbers toward negative infinity.
This option provides for an optimization of the rounding code for several blocks.
Round number toward zero.
See Block-Specific Parameters for the command-line information.
For more information, see Rounding in the Simulink Fixed Point User's Guide.
Specify whether overflows saturate.
Default: Off
When you select this check box, saturation applies to every internal operation on the block, not just the output or result.
In general, the code generation process can detect when overflow is not possible, in which case, no saturation code is necessary.
See Block-Specific Parameters for the command-line information.
Specify the minimum value that the block should output.
Default: []
The default value, [], is equivalent to -Inf.
Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values) for some blocks
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
This number must be a double scalar value.
See Block-Specific Parameters for the command-line information.
Specify the maximum value that the block should output.
Default: []
The default value, [], is equivalent to Inf.
Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values) for some blocks
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
This number must be a double scalar value.
See Block-Specific Parameters for the command-line information.
Specify the output data type.
Default: Inherit: Inherit via internal rule (Discrete-Time Integrator, Gain, Product, Sum, Switch block), Inherit: Inherit from 'Constant value' (Constant block), Inherit: Inherit via back propagation (Data Type Conversion block), Inherit: Same as input (Saturation block)
This option appears for some blocks. Simulink software chooses a combination of output scaling and data type that requires the smallest amount of memory consistent with accommodating the calculated output range and maintaining the output precision of the block and with the word size of the targeted hardware implementation specified for the model. If the Device type parameter on the Hardware Implementation configuration parameters pane is set to ASIC/FPGA, Simulink software chooses the output data type without regard to hardware constraints. Otherwise, Simulink software chooses the smallest available hardware data type capable of meeting the range and precision constraints. For example, if the block multiplies an input of type int8 by a gain of int16 and ASIC/FPGA is specified as the targeted hardware type, the output data type is sfix24. If Unspecified (assume 32-bit Generic), i.e., a generic 32-bit microprocessor, is specified as the target hardware, the output data type is int32. If none of the word lengths provided by the target microprocessor can accommodate the output range, Simulink software displays an error message in the Simulation Diagnostics Viewer.
Use data type of Constant value parameter. This option appears for some blocks.
Use data type of the driving block.
Use data type of sole input signal. This option appears for some blocks.
Use data type of first input signal. This option appears for some blocks.
Output data type is the same as accumulator data type. This option appears for some blocks.
Output data type is double.
Output data type is single.
Output data type is int8.
Output data type is uint8.
Output data type is int16.
Output data type is uint16.
Output data type is int32.
Output data type is unt32.
Output data type is fixed point fixdt(1,16,0).
Output data type is fixed point fixdt(1,16,2^0,0).
Use an enumerated data type, for example, Enum: BasicColors. This option appears for some blocks.
Use a data type object, for example, Simulink.NumericType.
See Block-Specific Parameters for the command-line information.
See Specifying Block Output Data Types in the Simulink User's Guide for more information.
Select the category of data to specify.
Default: Inherit (Constant, Data Type Conversion, Discrete Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch), Built in (Logical Operator, Relational Operator)
Inheritance rules for data types. Selecting Inherit enables a second menu/text box to the right. The following list is the possible values, which can vary by block:
Inherit from 'Constant value' (Constant block default)
Inherit via internal rule (Discrete-Time Integrator, Gain, Product, Sum, Switch block default)
Inherit via back propogation (Data Type Conversion block default)
auto (Inport, Outport block default)
Logical (see Configuration Parameters: Optimization)
Same as first input
Same as input (Saturation block default)
Same as accumulator
Built-in data types. Selecting Built in enables a second menu/text box to the right. The following list is the possible values, which can vary by block:
double (Constant, Data Type Conversion, Discrete-Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch block default)
single
int8
uint8
int16
uint16
int32
uint32
boolean (Logical Operator, Relational Operator block default)
Fixed-point data types.
Enumerated data types. This option is available on some blocks. Selecting Enumerated enables a second menu/text box to the right. The following list is the possible values, which can vary by block:
<class name>
Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right. The following list is the possible values, which can vary by block:
<data type expression>
Clicking the Show data type assistant button enables this parameter.
See Block-Specific Parameters for the command-line information.
See Using the Data Type Assistant in the Simulink User's Guide.
Specify whether you want the fixed-point data as signed or unsigned.
Default: Signed
Selecting Mode > Fixed point enables this parameter.
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Specify the bit size of the word that holds the quantized integer.
Default: 16
Minimum: 0
Maximum: 32
Large word sizes represent large values with greater precision than small word sizes.
Selecting Mode > Fixed point enables this parameter.
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.
Default: Best precision (Constant), Binary point (Data Type Conversion, Discrete-Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch), Integer (Logical Operator, Relational Operator)
Specify binary point location.
Enter slope and bias.
Specify best-precision values. This option appears for some blocks.
Specify integer. This setting has the same result as specifying a binary point location and setting fraction length to 0. This option appears for some blocks.
Selecting Mode > Fixed point enables this parameter.
Selecting Binary point enables:
Fraction length
Calculate Best-Precision Scaling
Selecting Slope and bias enables:
Slope
Bias
Calculate Best-Precision Scaling
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Specify fraction length for fixed-point data type.
Default: 0
Binary points can be positive or negative integers.
Selecting Scaling > Binary point enables this parameter.
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Specify slope for the fixed-point data type.
Default: 2^0
Specify any positive real number.
Selecting Scaling > Slope and bias enables this parameter.
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Specify bias for the fixed-point data type.
Default: 0
Specify any real number.
Selecting Scaling > Slope and bias enables this parameter.
See Block-Specific Parameters for the command-line information.
See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.
Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes |
Dimensionalized | Yes |
Multidimensionalized | Yes, only when the Multiplication parameter specifies Element-wise(.*) |
Zero Crossing | No |
![]() | Probe | Product of Elements | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |