DSP Blockset    
Cumulative Product

Compute the cumulative product of channel, column, or row elements

Library

Math Functions / Math Operations

Description

The Cumulative Product block computes the cumulative product of elements in each channel, column, or row of the M-by-N input matrix.

The inputs can be sample-based or frame-based vectors and matrices. The output always has the same size, dimension, rate, frame status, data type, and complexity as the input.

Sections of This Reference Page

Input and Output Characteristics

Valid Input to Multiply.   The block computes the cumulative product of both sample- and frame-based vector and matrix inputs. Inputs can be real or complex. When multiplying along channels or columns, 1-D unoriented vectors are treated as column vectors. When multiplying along rows, 1-D vectors are treated as row vectors.

Valid Reset Signal.   The optional reset port, Rst, accepts scalar values, which can be any built-in Simulink data type including Boolean. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.

Output Characteristics.   The output always has the same size, dimension, rate, frame status, data type, and complexity as the data signal input.

Multiplying Along Channels

When the Multiply input along parameter is set to Channels (running product), the block computes the cumulative product of the elements in each input channel. The running product of the current input takes into account the running product of all previous inputs. See the following sections for more information:

Multiplying Along Channels of Frame-Based Inputs.   For frame-based inputs, the block treats each input column as an independent channel. As the following figure and equation illustrate, the output has the following characteristics:

Given an M-by-N frame-based input, u, the output, y, is a frame-based M-by-N matrix whose first row has elements

Multiplying Along Channels of Sample-Based Inputs.   For sample-based inputs, the block treats each element of the input matrix as an independent channel. As the following figure and equation illustrate, the output has the following characteristics:

Given an M-by-N sample-based input, u, the output, y, is a sample-based M-by-N matrix with the elements

For convenience, length-M 1-D vector inputs are treated as M-by-1 column vectors when multiplying along channels, and the output is a length-M 1-D vector.

Resetting the Cumulative Product Along Channels.   When you set the Multiply input along parameter to Channels (running product), you can set the block to reset the running product whenever it detects a reset event at the optional Rst port. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input. The input to the Rst port can be of the Boolean data type.

When the block is reset for sample-based inputs, the block initializes the current output to the values of the current input. For frame-based inputs, the block initializes the first row of the current output to the values in the first row of the current input.

The Reset port parameter specifies the reset event, which can be one of the following:

Multiplying Along Columns

When the Multiply input along parameter is set to Columns, the block computes the cumulative product of each column of the input, where the current cumulative product is independent of the cumulative products of previous inputs.

The output has the same size, dimension, frame status, data type, and complexity as the input. The mth output row is the element-wise product of the first m input rows.

Given an M-by-N input, u, the output, y, is an M-by-N matrix whose jth column has elements

The block treats length-M 1-D vector inputs as M-by-1 column vectors when multiplying along columns.

Multiplying Along Rows

When the Multiply input along parameter is set to Rows, the block computes the cumulative product of the row elements, where the current cumulative product is independent of the cumulative products of previous inputs.

The output has the same size, dimension, frame status, and data type as the input. The nth output column is the element-wise product of the first n input columns.

Given an M-by-N input, u, the output, y, is an M-by-N matrix whose ith row has elements

The block treats length-N 1-D vector inputs as 1-by-N row vectors when multiplying along rows.

Dialog Box

Multiply input along
The dimension along which to compute the cumulative products. The options allow you to multiply along Channels (running product), Columns, and Rows. For more information, see the following sections:
Reset port
Determines the reset event that causes the block to reset the product along channels. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input. This parameter is enabled only when you set the Multiply input along parameter to Channels (running product). For more information, see Resetting the Cumulative Product Along Channels.

Supported Data Types

Input and Output Ports
Supported Data Types
Data input port, In
  • Double-precision floating point
  • Single-precision floating point
Reset input port, Rst
All built-in Simulink data types:
  • Double-precision floating point
  • Single-precision floating point
  • Boolean
  • 8-, 16-, and 32-bit signed integers
  • 8-, 16-, and 32-bit unsigned integers
Output port
Always has same data type as data input

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

Cumulative Sum
DSP Blockset
Matrix Product
DSP Blockset
cumprod
MATLAB

Also see Math Operations for a list of all the blocks in the Math Operations library.


  Create Diagonal Matrix Cumulative Sum