Sum

Purpose

Add and subtract input signals

Library

Control / Math

Description

../../_images/sum.svg

The Sum block adds or subtracts input signals, which may be scalars or vectors of the same size.

If the block has multiple inputs, it performs an element-wise summation or subtraction of the input signals. Scalar inputs are expanded to the necessary width.

If the block has a single input, it calculates the positive or negative sum of the elements of the input signal. In this case the sign displayed on the block icon changes to \(\sum\) or \(-\sum\).

Parameters

Icon shape

Specifies whether the block is drawn with a round or a rectangular shape. Round shape icons permit a maximum of three inputs.

List of operators or number of inputs

The inputs can be specified either with a string containing + or - for each input and | for spacers, or a positive integer declaring the number of inputs.

Output data type

The data type of the output signal. See Data Types. If you choose inherited, the minimum data type is int8_t.

Data type overflow handling

Specifies how a data type overflow is handled. See Data Types. This parameter only appears if Output data type is not set to a floating-point data type.

Probe Signals

Input \(i\)

The \(i\)-th input signal.

Output

The block output signal.