DSP Blockset |
 |
Constant Diagonal Matrix
Generate a square, diagonal matrix.
Library
Description

The Constant Diagonal Matrix block outputs a square diagonal matrix constant. The Constant along diagonal parameter determines the values along the matrix diagonal. This parameter can be a scalar to be repeated for all elements along the diagonal, or a vector containing the values of the diagonal elements. To generate the identity matrix, set the Constant along diagonal to 1
, or use the Identity Matrix block.
The output is frame-based when the Frame-based output check box is selected; otherwise, the output is sample-based.
Dialog Box

- Constant(s) along diagonal
- Specify the values of the elements along the diagonal. You may input a scalar or a vector. This parameter is tunable.
- If you specify any data type information in this field, it is overridden by the value of the Output data type parameter.
- Frame-based output
- Select to cause output to be frame-based. Otherwise, output is sample-based.
- Show additional parameters
- If selected, additional parameters specific to implementation of the block become visible as shown.

- Output data type
- Specify the output data type in one of the following ways:
- Choose one of the built-in data types from the drop-down list.
- Choose Fixed-point to specify the output data type and scaling in the Word length, Set fractional bits in output to, and Number of fractional bits in output parameters.
- Choose User-defined to specify the output data type and scaling in the User-defined data type, Set fractional bits in output to, and Number of fractional bits in output parameters.
- Choose Inherit from `Constant(s) along diagonal' to set the output data type and scaling to match the values of the Constant(s) along diagonal parameter.
- Choose Inherit via back propagation to set the output data type and scaling to match the next block downstream.
- The value of this parameter overrides any data type information specified in the Constant(s) along diagonal parameter.
- Word length
- Specify the word length, in bits, of the fixed-point output data type. This parameter is only visible if Fixed-point is selected for the Output data type parameter.
- User-defined data type
- Specify any built-in or fixed-point data type. You can specify fixed-point data types using the sfix,
ufix
, sint
, uint
, sfrac
, and ufrac
functions from the Fixed-Point Blockset. This parameter is only visible if User-defined is selected for the Output data type parameter.
- Set fractional bits in output to
- Specify the scaling of the fixed-point output by either of the following two methods:
- Choose Best precision to have the output scaling automatically set such that the output signal has the best possible precision.
- Choose User-defined to specify the output scaling in the Number of fractional bits in output parameter.
- This parameter is only visible if Fixed-point or User-defined is selected for the Output data type parameter, and if the specified output data type is a fixed-point data type.
- Number of fractional bits in output
- For fixed-point output data types, specify the number of fractional bits, or bits to the right of the binary point. This parameter is only visible if Fixed-point or User-defined is selected for the Output data type parameter, and if User-defined is selected for the Set fractional bits in output to parameter.
Supported Data Types
- Double-precision floating point
- Single-precision floating point
- Fixed-point
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
Also see the following topics:
| Complex Exponential | | Constant Ramp |  |