Compute square of input matrix

Math Functions / Matrices and Linear Algebra / Matrix Operations

`dspmtrx3`

The Matrix Square block computes the square of an *M*-by-*N* input
matrix, *u*, by premultiplying with the Hermitian
transpose.

y = u' * u % Equivalent MATLAB code

The block treats length-*M* unoriented vector
inputs as an *M*-by-1 matrix. When the input is an *M*-by-*N* matrix,
the output of the block is an *N*-by-*N* matrix.

The Matrix Square block is useful in a variety of applications:

General matrix squares — The Matrix Square block computes the output matrix,

*y*, without explicitly forming*u'*. It is therefore more efficient than other methods for computing the matrix square.Sum of squares — When the input is a column vector (

*N*=1), the block's operation is equivalent to a multiply-accumulate (MAC) process, or inner product. The output is the sum of the squares of the input, and is always a real scalar.Correlation matrix — When the input is a row vector (

*M*=1), the output,*y*, is the symmetric autocorrelation matrix, or outer product.

The **Signal Attributes** pane of the
Matrix Square block dialog appears as follows.

**Output minimum**Specify the minimum value the block should output. The default value is

`[]`

(unspecified). Simulink^{®}software uses this value to perform:Simulation range checking (see Signal Ranges)

Automatic scaling of fixed-point data types

**Output maximum**Specify the maximum value the block should output. The default value is

`[]`

(unspecified). Simulink software uses this value to perform:Simulation range checking (see Signal Ranges)

Automatic scaling of fixed-point data types

**Output data type**Specify the output data type. You can set it to:

A rule that inherits a data type, for example,

`Inherit: Inherit via internal rule`

An expression that evaluates to a valid data type, for example,

`fixdt([],16,0)`

Click the

**Show data type assistant**button to display the**Data Type Assistant**, which helps you set the**Output data type**parameter.See Specify Block Output Data Types for more information.

**Lock output data type setting against changes by the fixed-point tools**Select this parameter to prevent the fixed-point tools from overriding the

**Output data type**you specify on the block mask.**Integer rounding mode**Select the rounding mode for fixed-point operations.

**Overflow mode**Select this check box to have overflows saturate to the maximum or minimum value that the data type can represent. If you clear this check box, the block wraps all overflows. See overflow mode for more information.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code

Double-precision floating point

Single-precision floating point

Matrix Multiply | DSP System Toolbox |

Matrix Product | DSP System Toolbox |

Matrix Sum | DSP System Toolbox |

Was this topic helpful?