Main Content

Extract Triangular Matrix

Extract lower or upper triangle from input matrices

  • Extract Triangular Matrix block

Libraries:
DSP System Toolbox / Math Functions / Matrices and Linear Algebra / Matrix Operations

Description

The Extract Triangular Matrix block creates a triangular matrix output from the upper or lower triangular elements of an M-by-N input matrix. The block treats length-M unoriented vector inputs as an M-by-1 matrix.

Examples

expand all

Open the ex_extracttriang_ref model. This model shows the extraction of upper and lower triangles from a 5-by-3 input matrix.

Ports

Input

expand all

Specify the input as a vector or a matrix of size M-by-N. The block treats length-M unoriented vector inputs as an M-by-1 matrix.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point
Complex Number Support: Yes

Output

expand all

Extract the lower triangle or the upper triangle of the input matrix. When you set the Extract parameter to:

  • Upper — The block copies the elements on and above the main diagonal of the input matrix to an output matrix of the same size. The first row of the output matrix is identical to the first row of the input matrix. The elements below the main diagonal of the output matrix are zero.

  • Lower — The block copies the elements on and below the main diagonal of the input matrix to an output matrix of the same size. The first column of the output matrix is identical to the first column of the input matrix. The elements above the main diagonal of the output matrix are zero.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point
Complex Number Support: Yes

Parameters

expand all

Specify the component of the matrix to copy to the output:

  • Upper — The block copies the elements on and above the main diagonal of the input matrix to an output matrix of the same size. The first row of the output matrix is identical to the first row of the input matrix. The elements below the main diagonal of the output matrix are zero.

  • Lower — The block copies the elements on and below the main diagonal of the input matrix to an output matrix of the same size. The first column of the output matrix is identical to the first column of the input matrix. The elements above the main diagonal of the output matrix are zero.

Specify the type of simulation to run. You can set this parameter to:

  • Interpreted execution –– Simulate model using the MATLAB® interpreter. This option shortens startup time.

  • Code generation –– Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations as long as the model does not change. This option requires additional startup time but provides faster subsequent simulations.

Block Characteristics

Data Types

Boolean | double | fixed point | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

Version History

Introduced before R2006a

expand all