Main Content

Create Diagonal Matrix

Create square diagonal matrix from diagonal elements

  • Library:
  • DSP系统工具箱/数学功能ons / Matrices and Linear Algebra / Matrix Operations

  • Create Diagonal Matrix block

Description

The Create Diagonal Matrix block populates the diagonal of theM-by-Mmatrix output with the elements contained in the length-Mvector input D. The elements off the diagonal are zero.

A = diag(D) % Equivalent MATLAB code

Ports

Input

expand all

Input to convert into a diagonal matrix, specified as anM-element vector.

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

Output

expand all

Output specified as anM-by-Mmatrix, whereMis the length of the input vector.

The output is equivalent to:

A = diag(D) % Equivalent MATLAB code

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

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

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

See Also

Blocks

Functions

Introduced before R2006a