Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

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 preset parameter values:

Setting non-default values for either of those parameters can change a Product of Elements 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 parameter Multiply over, which has the default value All dimensions:

If you set Multiply over to Specified dimension, the Dimension parameter appears.

To 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 inputs, Multiply over, and Dimension. These values can require change. For other capabilities, see the Product block documentation, which also describes the Signal Attributes Pane of the Product of Elements block.

Number of inputs

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

Parameter ValueBlock BehaviorBlock Icon
* or 1
  • Copies a scalar input unchanged

  • Collapses a vector input to a scalar by multiplying all elements together

  • Collapses a matrix input to a scalar or vector by multiplying elements together based on the Multiply over parameter

/
  • Outputs the arithmetic inverse of a scalar input

  • Collapses a vector input to a scalar by multiplying the inverses of all elements together

  • Collapses a matrix input to a scalar or vector by multiplying the inverses of elements together based on the Multiply over parameter

Multiply over

This parameter appears only when Multiplication is Element-wise(.*) and Number of inputs is *, 1, or /. The parameter affects only a matrix input. The possible values are:

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

Specified dimension — The block outputs a vector, in which the composition 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 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. The output vector depends on the value of Number of inputs:

  • * or 1

    Multiply the values of the column or row elements

  • /

    Multiply the inverses of the column or row 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 inputs: *

Multiplication: Element-wise(.*)

Number of inputs: /

Multiplication: Element-wise(.*)

Number of inputs: *

Multiplication: Element-wise(.*)

Number of inputs: *

Multiply over: All dimensions

Multiplication: Element-wise(.*)

Number of inputs: *

Multiply over: Specified dimension

Dimension: 1

Multiplication: Element-wise(.*)

Number of inputs: /

Multiply over: Specified dimension

Dimension: 2

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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