Main Content

PS Sum of Elements

Calculate sum of elements of vector or matrix input physical signal

Since R2023b

  • PS Sum of Elements block

Libraries:
Simscape / Foundation Library / Physical Signals / Functions

Description

The PS Sum of Elements block calculates the sum of elements of a vector or matrix input physical signal:

y=sum(u)

where:

  • y is the physical signal at the output port O.

  • u is the physical signal at the input port I.

Ports

Input

expand all

Input physical signal specified as a row or column vector or a matrix.

The port name is not visible in the block icon, but you can see this name in the underlying source file by clicking the Source code link in the Description tab of the block dialog box.

Output

expand all

Output physical signal. If the input signal is a vector, then the output signal is a scalar. If the input signal is a matrix, then by default the block computes the column-wise sum for each dimension. For example, if the input signal is a two-dimensional matrix, then by default the output signal is a vector. If you select the Sum all elements check box, then the output signal is a scalar.

The port name is not visible in the block icon, but you can see this name in the underlying source file by clicking the Source code link in the Description tab of the block dialog box.

Parameters

expand all

If the input signal is a matrix, then by default the block computes the column-wise sums of elements for each dimension. To sum all the elements of the matrix, select the Sum all elements check box.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2023b