DSP Blockset Previous page   Next Page
Matrix Sum

Sum the elements of a matrix along rows or columns

Library

Math Functions / Matrices and Linear Algebra / Matrix Operations

Description



The Matrix Sum block sums the elements of an M-by-N input matrix u along either the rows or columns. When the Sum along parameter is set to Rows, the block sums across the elements of each row and outputs the resulting M-by-1 matrix. A length-N 1-D vector input is treated as a 1-by-N matrix.

This is equivalent to

When the Sum along parameter is set to Columns, the block sums down the elements of each column and outputs the resulting 1-by-N matrix. A length-M 1-D vector input is treated as a M-by-1 matrix.

This is equivalent to

The output of the Matrix Sum block has the same frame status as the input. This block accepts real and complex floating-point and fixed-point inputs.

Fixed-Point Data Types

The following diagram shows the data types used within the Matrix Sum block for fixed-point signals.

You can set the accumulator and output data types in the block mask as discussed in Dialog Box below.

Dialog Box

Sum along
Indicate whether to sum the elements of each row or of each column of the input.
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown.

Allow overrides from DSP Fixed-Point Attributes blocks
If you select this parameter, fixed-point data types for this block may be set by DSP Fixed-Point Attributes blocks in your model. If this parameter is unselected, the data types are always set by the parameters in the block mask.
Fixed-point output attributes
Choose how you will specify the output word length and fraction length. If you select Same as input, these characteristics will match those of the input to the block. If you select User-defined, the Output word length and Output fraction length parameters become visible.
Output word length
Specify the word length, in bits, of the output. This parameter is only visible if User-defined is specified for the Fixed-point output attributes parameter.
Output fraction length
Specify the fraction length, in bits, of the output. This parameter is only visible if User-defined is specified for the Fixed-point output attributes parameter.
Fixed-point accumulator attributes

As depicted above, the elements of the block input are cast to the accumulator data type before they are added together. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how you would like to designate this accumulator word and fraction lengths.
If you select Same as output, the accumulator word and fraction lengths are the same as those of the output. If you select User-defined, the Accumulator word length and Accumulator fraction length parameters become visible.
Accumulator word length
Specify the word length, in bits, of the accumulator. This parameter is only visible when User-defined is specified for the Fixed-point accumulator attributes parameter.
Accumulator fraction length
Specify the fraction length, in bits, of the accumulator. This parameter is only visible when User-defined is specified for the Fixed-point accumulator attributes parameter.
Round integer calculations toward
Select the rounding mode for fixed-point operations.
Saturate on integer overflow
If selected, overflows saturate.

Supported Data Types

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

See Also

Matrix Product
DSP Blockset
Matrix Multiply
DSP Blockset
sum
MATLAB


Previous page  Matrix Square Matrix Viewer Next page

Learn more about the latest releases of MathWorks products:

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