| Simulink Reference | ![]() |
Library
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:
+-+" requires three inputs and configures the block to subtract the second (middle) input from the first (top) input, and then add the third (bottom) input.
All nonscalar inputs must have the same dimensions. Scalar inputs will be expanded to have the same dimensions as the other inputs.
+" characters.
+" or "-" will collapse the vector using the specified operation.
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:
+) 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.
|) between the signs in the List of signs parameter. For example, "++|--" creates an extra space between the second and third input ports.
-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:
Specify via dialog, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling tool parameters become visible.
Specify via dialog for the Output data type mode parameter.
Specify via dialog for the Output data type mode parameter.
Specify via dialog for the Output data type mode parameter.
Characteristics
| Direct Feedthrough |
Yes |
| Sample Time |
Specified in the Sample time parameter |
| Scalar Expansion |
Yes |
| States |
0 |
| Dimensionalized |
Yes |
| Zero Crossing |
No |
| Subtract | Sum of Elements | ![]() |
© 1994-2005 The MathWorks, Inc.