Documentation Center

  • Trial Software
  • Product Updates

Create Diagonal Matrix

Create square diagonal matrix from diagonal elements

Library

Math Functions / Matrices and Linear Algebra / Matrix Operations

dspmtrx3

Description

The Create Diagonal Matrix block populates the diagonal of the M-by-M matrix output with the elements contained in the length-M vector input, D. The elements off the diagonal are zero.

A = diag(D)					Equivalent MATLAB code

Dialog Box

Supported Data Types

PortSupported Data Types

D

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

A

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

Constant Diagonal MatrixDSP System Toolbox™
Extract DiagonalDSP System Toolbox
diagMATLAB®

Was this topic helpful?