| Contents | Index |
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 example 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 example 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 that Simulink supports, including fixed-point data types. For more information, see Data Types Supported by Simulink in the Simulink documentation.
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.
Specify the rounding mode for fixed-point operations.
Default: Zero
Rounds both positive and negative numbers toward positive infinity. Equivalent to the MATLAB ceil function.
Rounds number to the nearest representable value. If a tie occurs, rounds to the nearest even integer. Equivalent to the Fixed-Point Toolbox convergent function.
Rounds both positive and negative numbers toward negative infinity. Equivalent to the MATLAB floor function.
Rounds number to the nearest representable value. If a tie occurs, rounds toward positive infinity. Equivalent to the Fixed-Point Toolbox nearest function.
Rounds number to the nearest representable value. If a tie occurs, rounds positive numbers toward positive infinity and rounds negative numbers toward negative infinity. Equivalent to the Fixed-Point Toolbox round function.
Automatically chooses between round toward floor and round toward zero to generate rounding code that is as efficient as possible.
Rounds number toward zero. Equivalent to the MATLAB fix function.
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
Overflows saturate to either the minimum or maximum value that the data type can represent.
For example, an overflow associated with a signed 8-bit integer can saturate to -128 or 127.
Overflows wrap to the appropriate value that is representable by the data type.
For example, the number 130 does not fit in a signed 8-bit integer and wraps to -126.
Consider selecting this check box when your model has possible overflow and you want explicit saturation protection in the generated code.
Consider clearing this check box when you want to optimize efficiency of your generated code.
Clearing this check box also helps you avoid overspecifying how a block handles out-of-range signals. For more information, see Checking for Signal Range Errors.
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 this case, the code generator does not produce saturation code.
See Block-Specific Parameters for the command-line information.
Specify the minimum value that the block should output.
Default: [] (unspecified)
This number must be a finite real double scalar value.
Note If you specify a bus object as the data type for this block, do not set the minimum value for bus data on the block. Simulink ignores this setting. Instead, set the minimum values for bus elements of the bus object specified as the data type. For information on the Minimum property of a bus element, see Simulink.BusElement. |
Simulink uses the minimum to perform:
Parameter range checking (see Checking Parameter Values) for some blocks
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
See Block-Specific Parameters for the command-line information.
Specify the maximum value that the block should output.
Default: [] (unspecified)
This number must be a finite real double scalar value.
Note If you specify a bus object as the data type for this block, do not set the maximum value for bus data on the block. Simulink ignores this setting. Instead, set the maximum values for bus elements of the bus object specified as the data type. For information on the Maximum property of a bus element, see Simulink.BusElement. |
Simulink uses the maximum value to perform:
Parameter range checking (see Checking Parameter Values) for some blocks
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
See Block-Specific Parameters for the command-line information.
Specify the output data type.
Default: Inherit: Inherit via internal rule
Simulink 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 the driving block.
Use data type of the first input signal.
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 uint32.
Output data type is fixed point fixdt(1,16,0).
Output data type is fixed point fixdt(1,16,2^0,0).
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
Inheritance rules for data types. Selecting Inherit enables a second menu/text box to the right. Select one of the following choices:
Inherit via internal rule (default)
Inherit via back propagation
Same as first input
Built-in data types. Selecting Built in enables a second menu/text box to the right. Select one of the following choices:
double (default)
single
int8
uint8
int16
uint16
int32
uint32
Fixed-point data types.
Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right, where you can enter the 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 data type override mode for this signal.
Default: Inherit
Inherits the data type override setting from its context, that is, from the block, Simulink.Signal object or Stateflow chart in Simulink that is using the signal.
Ignores the data type override setting of its context and uses the fixed-point data type specified for the signal.
The ability to turn off data type override for an individual data type provides greater control over the data types in your model when you apply data type override. For example, you can use this option to ensure that data types meet the requirements of downstream blocks regardless of the data type override setting.
This parameter appears only when the Mode is Built in or Fixed point.
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
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
Specify binary point location.
Enter slope and bias.
Specify best-precision values.
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 Detection | No |

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