Sum
If the block has more than one input, it performs element-wise addition or subtraction its inputs. All inputs must have the same size or be 1x1. If the block has one input, the output is 1x1 and is obtained by adding (subtracting) all the entries of the input. Addition (+) and subtractions (-) characters indicate the operation to be performed on the inputs.
Library
MathOperations
Description
The Sum block performs addition or subtraction on its inputs. This block can add or subtract scalar, vector, or matrix inputs. The number of inputs is given by the first parameter. The second parameter is a list of signs.
Inputs can be either real or complex.
Inputs are either scalar, or vector. If vector, all vectors must be of the same size.
The Sum block can also collapse the elements of a single input vector: In case of a single input, the output is the sum of all elements of the input vector.
Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
nin | Number of inputs | real scalar value. | Number | |
in_ports | Input port information | Structure | ||
in_ports/sgn | Operators | List of signs (+ or -) to specify the operation applied to each entry, respectively. | Cell of strings | '+' |
satur | Do on overflow | Defines the action in case of an overflow during the operation. Options are : "Nothing" (gives a normal, non satured result), "Saturate" (gives a saturated result), "Error" (gives an error message). | String | 'Nothing' |
externalActivation | External activation | Specifies whether the block receives an external activation or inherits its activation through its regular input ports. When External Activation is selected, an additional activation port is added to the block. By default, external activation is not selected. | Number | 0 |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
Port 1 | explicit | input | nin | |
Port 2 | explicit | output | 1 | |
Port 3 | activation | input | externalActivation |
Advanced Properties
Name | Value | Description |
---|---|---|
always active | no | |
direct-feedthrough | yes | |
zero-crossing | no | |
mode | no | |
continuous-time state | no | |
discrete-time state | no |