Product of Elements - Copy or invert one scalar input, or collapse one nonscalar input

Library

Math Operations

Description

The Product of Elements block inputs one scalar, vector, or matrix. You can use the block to:

The Product of Elements block is functionally a Product block that has two block parameter values preset:

Setting non-default values for either of those parameters can change a Product of Element block to be functionally equivalent to a Product block or a Divide block. See the documentation of those two blocks for more information.

Parameters and Dialog Box

The Product of Elements block has the same parameters and dialog box as the Product block, plus the additional parameter Multiply Over, which has the default value All Dimensions:

If you set Multiply Over to Specified Dimension, the Dimension parameter appears below it.

If all you need to do is copy, invert, or collapse one input to create an output, you can use the Product of Elements block with default values for all parameters except Number of elements, Multiply over, and Dimension, whose values may need to be changed. If you need additional capabilities, see the Product block documentation, which also describes the capabilities of the Product of Elements block's Signal Attributes Pane.

Number of elements

This parameter is the same as in the Product block, but it must be set to * (the default) or 1 or / to achieve the effect of a Product of Elements block.

If Number of elements is * or 1 the block:

If Number of elements is / the block icon changes to and the block:

Multiply over

This parameter appears only when Multiplication is Element-wise(.*) and Number of Inputs is * or 1 or /. The parameter affects only a matrix input, and has no effect on a scalar or vector input. The possible values are:

All dimensions — The block outputs a scalar that is product of all elements of the matrix, or the product of their inverses, depending on the value of Number of elements.

Specified dimension — The block outputs a vector, the composition of which depends on the value of the Dimension parameter.

Dimension

This parameter appears only when the Multiply over parameter appears and is set to Specified Dimension. The parameter affects only a matrix input, and must be set to 1 for a scalar or vector input. The possible values are:

1 — Output a vector that contains an element for each column of the input matrix.

2 — Output a vector that contains an element for each row of the input matrix.

Each element of the output vector contains the product of all elements in the corresponding column or row of the input matrix, or the product of the inverses of those elements, depending on the value of Number of elements:

Examples

This table shows the output of the Product of Elements block for some typical inputs using default block parameter values except as shown in the table.

Parameter ValuesExamples

Multiplication: Element-wise(.*)

Number of elements: *

Multiplication: Element-wise(./)

Number of elements: /

Multiplication: Element-wise(.*)

Number of elements: *

Multiplication: Element-wise(.*)

Number of elements: *

Multiply Over: All Dimensions

Multiplication: Element-wise(.*)

Number of elements: *

Multiply Over: Specified Dimension

Dimension: 1

Multiplication: Element-wise(.*)

Number of elements: /

Multiply Over: Specified Dimension

Dimension: 2

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS