dsp.CumulativeProduct

Cumulative product of channel, column, or row elements

Description

The dsp.CumulativeProduct System object™ computes the cumulative product of channel, column, or row elements.

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

  1. Create the dsp.CumulativeProduct object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

Creation

Description

example

cprod = dsp.CumulativeProduct returns a cumulative product object, cprod, that computes the cumulative product of input matrix or input vector elements along the default dimension.

cprod = dsp.CumulativeProduct(Name,Value) returns a cumulative product object with each specified property set to the specified value.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

Specify the computation dimension as Channels (running product), Rows, or Columns.

Set this property to true to enable resetting the cumulative product. When you set this property to true, specify a reset signal to the object algorithm to reset the cumulative product.

Dependencies

You can access this property when the Dimension property is set to Channels (running product).

Specify the event on the reset input port that causes resetting the cumulative product to Rising edge, Falling edge, Either edge, or Non-zero.

Dependencies

This property applies when you set the ResetInputPort property to true and the Dimension property to Channels (running product).

Fixed-Point Properties

Specify the rounding method as one of Ceiling, Convergent, Floor , Nearest, Round, Simplest, or Zero.

Specify the overflow action as one of Wrap or Saturate.

Specify the intermediate product fixed-point data type as Same as input or Custom.

Specify the intermediate product fixed-point type as a scaled numerictype object with a Signedness of Auto.

Dependencies

This property applies when you set the IntermediateProductDataType property to Custom.

Specify the product output fixed-point data type as one of | Same as input | Custom |.

Specify the product output fixed-point type as a scaled numerictype object with a Signedness of Auto.

Dependencies

This property applies when you set the ProductDataType property to Custom.

Specify the accumulator fixed-point data type as Same as product output, Same as input, or Custom.

Specify the accumulator fixed-point type as a scaled numerictype object with a Signedness of Auto.

Dependencies

This property applies when you set the AccumulatorDataType property to Custom.

Specify the output fixed-point data type as one of | Same as product output | Same as input | Custom |.

Specify the output fixed-point type as a scaled numerictype object with a Signedness of Auto.

Dependencies

This property applies when you set the OutputDataType property to Custom.

Usage

Description

example

y = cprod(x) computes the cumulative product along the specified dimension for the input x.

y = cprod(x,r) resets the cumulative product object's state based on the ResetCondition property value and the value of the reset signal, r, when the ResetInputPort property is true.

Input Arguments

expand all

Data input, specified as a vector or a matrix.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes

Reset signal used to reset the running cumulative product, specified as a scalar. The object resets the running cumulative product if the reset signal satisfies the ResetCondition.

Dependencies

This input is applicable only when Dimension is set to 'Channels (running product)' and ResetInputPort is set to true.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical | fi

Output Arguments

expand all

Cumulative product of the input signal, returned as a vector or a matrix.

The size, data type, and complexity characteristics of the output signal match that of the input signal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

expand all

Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

Use the dsp.CumulativeProduct object to compute the cumulative product of a matrix.

 cprod = dsp.CumulativeProduct;
 x = magic(2)
x = 2×2

     1     3
     4     2

 y = cprod(x)
y = 2×2

     1     3
     4     6

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

Algorithms

This object implements the algorithm, inputs, and outputs described on the Cumulative Product block reference page. The object properties correspond to the block parameters, except the Reset port block parameter corresponds to both the ResetCondition and ResetInputPort object properties.

Extended Capabilities

See Also

System Objects

Introduced in R2012a