This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Matrix Square

Compute square of input matrix


Math Functions / Matrices and Linear Algebra / Matrix Operations



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.


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 (Simulink))

  • 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 (Simulink))

  • 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. For more information on this rule, see 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 Control Signal Data Types (Simulink) 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.

Saturate on integer overflow

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.

Supported Data Types

  • Double-precision floating point

  • Single-precision floating point

See Also

Matrix MultiplyDSP System Toolbox
Matrix ProductDSP System Toolbox
Matrix SumDSP System Toolbox

Introduced before R2006a

Was this topic helpful?