DSP Blockset | ![]() ![]() |
Compute the cumulative sum of row or column elements.
Library
Math Functions / Math Operations
Description
The Cumulative Sum block computes the cumulative sum of the row or column elements in the M-by-N input matrix u
.
Columnwise Summing
When the Cumulative Sum along parameter is set to Columns, the block computes the cumulative sum of the column elements.
y = cumsum(u) % Equivalent MATLAB code
The output is an M-by-N matrix whose jth column has elements
The frame status of the output is the same as the input. For sample-based inputs, the first row of each successive output is the same as that of the corresponding input. For convenience, length-M 1-D vector inputs are treated as M-by-1 column vectors for column-wise summation, and the output is a length-M 1-D vector.
For frame-based inputs, the first row of the first output is the same as that of the first input, and the first row of each subsequent output contains the sum of the first row of the current input (time t) and the last row of the previous output (time t-Tf).
Rowwise Summing
When the Cumulative Sum along parameter is set to Rows, the block computes the cumulative sum of the row elements.
y = cumsum(u,2) % Equivalent MATLAB code
The output is an M-by-N matrix whose ith row has elements
The frame status of the output is the same as the input. For both sample-based and frame-based inputs, the first column of each successive output is the same as that of the corresponding input. For convenience, length-N 1-D vector inputs are treated as 1-by-N row vectors for row-wise summation, and the output is a length-N 1-D vector.
Dialog Box
See Also
Difference |
DSP Blockset |
Matrix Sum |
DSP Blockset |
cumsum |
MATLAB |
![]() | Create Diagonal Matrix | dB Conversion | ![]() |