Documentation

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.

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

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

Extract DiagonalDSP System Toolbox™
diagMATLAB®

Introduced before R2006a

Was this topic helpful?