Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.CumulativeSum System object

Package: dsp

Cumulative sum of channel, column, or row elements

Description

The CumulativeSum object computes the cumulative sum of channel, column, or row elements.

To compute the cumulative sum of channel, column, or row elements:

  1. Define and set up your cumulative sum object. See Construction.

  2. Call step to compute the cumulative sum according to the properties of dsp.CumulativeSum. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

H = dsp.CumulativeSum returns a cumulative sum System object, H, which computes the running cumulative sum for each channel in the input.

H = dsp.CumulativeSum('PropertyName',PropertyValue,...) returns a cumulative sum object, H, with each specified property set to the specified value.

Properties

Dimension

Computation dimension for cumulative sum

Specify the computation dimension as one of | Channels (running sum) | Rows | Columns |. The default is Channels (running sum).

ResetInputPort

Enable resetting cumulative sum via input port.

Set this property to true to enable resetting the cumulative sum. When you set this property to true, you also specify a reset input to the step method to reset the cumulative sum. The default is false.

ResetCondition

Reset condition for cumulative sum

Specify the event on the reset input port that resets the cumulative sum as one of | Rising edge | Falling edge | Either edge | Non-zero |. This property applies when you set the ResetInputPort property to true. The default is Rising edge.

 Fixed-Point Properties

Methods

cloneCreate cumulative sum object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of cumulative sum object to zero
stepCumulative sum along specified dimension for input

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Use the dsp.CumulativeSum object to compute the cumulative sum of a matrix.

 hcsum = dsp.CumulativeSum;
 x = magic(2)
 y = hcsum(x)
x =

     1     3
     4     2


y =

     1     3
     5     5

The cumulative sum is computed column-wise along each channel.

Algorithms

This object implements the algorithm, inputs, and outputs described on the Cumulative Sum block reference page. The object properties correspond to the block properties, except:

The Reset port block parameter corresponds to both the ResetCondition and the ResetInputPort object properties

Introduced in R2012a

Was this topic helpful?