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.

    Sum

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

Sum_0

NameLabelDescriptionData TypeValid 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'
'Saturate'
'Error'

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
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

input

nin

Port 2

explicit

output

1

Port 3

activation

input

externalActivation

Advanced Properties

NameValueDescription

always active

no

direct-feedthrough

yes

zero-crossing

no

mode

no

continuous-time state

no

discrete-time state

no

See Also