Simulink Reference Previous page   Next Page
Sum

Add or subtract inputs

Library

Math Operations

Description

The Sum block performs addition or subtraction on its inputs. This block can add or subtract scalar, vector, or matrix inputs. It can also collapse the elements of a single input vector.

You specify the operations of the block with the List of Signs parameter. Plus (+), minus (-), and spacer (|) characters indicate the operations to be performed on the inputs:

The Sum block first converts the input data type(s) to the output data type using the specified rounding and overflow modes, and then performs the specified operations.

Data Type Support

The Sum block accepts real or complex signals of any data type supported by Simulink, including fixed-point data types. The inputs may be of different data types unless you select the Require all inputs to have same data type parameter.

For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.

Parameters and Dialog Box

The Main pane of the Sum block dialog appears as follows:

Icon shape
Designate the icon shape of the block.
List of signs
Enter as many plus (+) and minus (-) characters as there are inputs. Addition is the default operation, so if you only want to add the inputs, enter the number of input ports. For a single vector input, "+" or "-" will collapse the vector using the specified operation.
You can manipulate the positions of the input ports on the block by inserting spacers (|) between the signs in the List of signs parameter. For example, "++|--" creates an extra space between the second and third input ports.
Sample time (-1 for inherited)
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.

The Signal data types pane of the Sum block dialog appears as follows:

Require all inputs to have same data type
Select this parameter to require that all inputs must have the same data type.
Output data type mode
Specify the output data type and scaling to be the same as the first input, or inherit the data type and scaling from an internal rule or by backpropagation. You can also choose a built-in data type from the drop-down list. Lastly, if you choose Specify via dialog, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling tool parameters become visible.
Output data type
Specify any data type, including fixed-point data types. This parameter is only visible if you select Specify via dialog for the Output data type mode parameter.
Output scaling value
Set the output scaling using binary point-only or [Slope Bias] scaling. This parameter is only visible if you select Specify via dialog for the Output data type mode parameter.
Lock output scaling against changes by the autoscaling tool
Select to lock scaling of outputs. This parameter is only visible if you select Specify via dialog for the Output data type mode parameter.
Round integer calculations toward
Select the rounding mode for fixed-point operations.
Saturate on integer overflow
Select to have overflows saturate.

Characteristics

Direct Feedthrough
Yes
Sample Time
Specified in the Sample time parameter
Scalar Expansion
Yes
States
0
Dimensionalized
Yes
Zero Crossing
No


Previous page  Subtract Sum of Elements Next page

© 1994-2005 The MathWorks, Inc.