Documentation Center |
Generate dot product of two vectors
The Dot Product block generates the dot product of the vectors at its inputs. The scalar output, y, is equal to the MATLAB® operation
y = sum(conj(u1) .* u2 )
where u1 and u2 represent the vectors at the block's top and bottom inputs, respectively. (See How to Rotate a Block in the Simulink® documentation for a description of the port order for various block orientations.) The inputs can be vectors, column vectors (single-column matrices), or scalars. If both inputs are vectors or column vectors, they must be the same length. If u1 and u2 are both column vectors, the block outputs the equivalent of the MATLAB expression u1'*u2.
The elements of the input vectors can be real- or complex-valued signals. The signal type (complex or real) of the output depends on the signal types of the inputs.
| Input 1 | Input 2 | Output |
|---|---|---|
real | real | real |
real | complex | complex |
complex | real | complex |
complex | complex | complex |
To perform element-by-element multiplication without summing, use the Product block.
The Dot Product block accepts and outputs signals of any numeric data type that Simulink supports, including fixed-point data types.
For more information, see Data Types Supported by Simulink.
The Main pane of the Dot Product block dialog box appears as follows:

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

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specify Sample Time in the Simulink documentation for more information.
Select to require all inputs to have the same data type.
Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via back propagation
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Output
data type parameter.
See Specify Block Output Data Types for more information.
Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Use Lock Output Data Type Setting.
Specify the rounding mode for fixed-point operations. For more information, see Rounding. in the Fixed-Point Designer™ documentation.
| Action | Reasons for Taking This Action | What Happens for Overflows | Example |
|---|---|---|---|
Select this check box. | Your model has possible overflow, and you want explicit saturation protection in the generated code. | Overflows saturate to either the minimum or maximum value that the data type can represent. | An overflow associated with a signed 8-bit integer can saturate to –128 or 127. |
Do not select this check box. | You want to optimize efficiency of your generated code. You want to avoid overspecifying how a block handles out-of-range signals. For more information, see Checking for Signal Range Errors. | Overflows wrap to the appropriate value that is representable by the data type. | The number 130 does not fit in a signed 8-bit integer and wraps to –126. |
When you select this check box, saturation applies to every internal operation on the block, not just the output or result. Usually, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.