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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Generate discrete- or continuous-time constant signal

Sources

`dspobslib`

The DSP Constant block is still supported but is likely to be obsoleted in a future release. We strongly recommend replacing this block with the Constant block.

The DSP Constant block generates a signal whose value remains
constant throughout the simulation. The **Constant value** parameter
specifies the constant to output, and can be any valid MATLAB^{®} expression
that evaluates to a scalar, vector, or matrix.

When **Sample mode** is set to `Continuous`

,
the output is a continuous-time signal. When **Sample mode** is
set to `Discrete`

, the **Sample time** parameter
is visible, and the signal has the discrete output period specified
by the **Sample time** parameter.

You can set the output signal to `Frame-based`

, `Sample-based`

,
or `Sample-based (interpret vectors as 1-D)`

with
the **Output **parameter.

The **Main** pane of the DSP Constant
block dialog box appears as follows.

**Constant value**Specify the constant to generate. This parameter is Tunable (Simulink); values entered here can be tuned, but their dimensions must remain fixed.

When you specify any data type information in this field, it is overridden by the value of the

**Output data type**parameter in the**Data Types**pane, unless you select`Inherit from 'Constant value'`

.**Sample mode**Specify the sample mode of the output,

`Discrete`

for a discrete-time signal or`Continuous`

for a continuous-time signal.**Output**Specify whether the output is

`Sample-based (interpret vectors as 1-D)`

,`Sample-based`

, or`Frame-based`

. When you select`Sample-based`

and the output is a vector, its dimension is constrained to match the**Constant value**dimension (row or column). When you select`Sample-based (interpret vectors as 1-D)`

, however, the output has no specified dimensionality.**Sample time**Specify the discrete sample period for sample-based outputs. When you select

`Frame-based`

for the**Output**parameter, this parameter is named**Frame period**, and is the discrete frame period for the frame-based output. This parameter is only visible when you select`Discrete`

for the**Sample mode**parameter.

The **Data Types** pane of the DSP Constant
block dialog box appears as follows.

**Output data type**Specify the output data type in one of the following ways:

Choose one of the built-in data types from the list.

Choose

`Fixed-point`

to specify the output data type and scaling in the**Signed**,**Word length**,**Set fraction length in output to**, and**Fraction length**parameters.Choose

`User-defined`

to specify the output data type and scaling in the**User-defined data type**,**Set fraction length in output to**, and**Fraction length**parameters.Choose

`Inherit from 'Constant value'`

to set the output data type and scaling to match the values of the**Constant value**parameter in the**Main**pane.Choose

`Inherit via back propagation`

to set the output data type and scaling to match the following block.

The value of this parameter overrides any data type information specified in the

**Constant value**parameter in the**Main**pane, except when you select`Inherit from 'Constant value'`

.**Signed**Select to output a signed fixed-point signal. Otherwise, the signal is unsigned. This parameter is only visible when you select

`Fixed-point`

for the**Output data type**parameter.**Word length**Specify the word length, in bits, of the fixed-point output data type. This parameter is only visible when you select

`Fixed-point`

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 following Fixed-Point Designer™ functions:

`sfix`

,`ufix`

,`sint`

,`uint`

,`sfrac`

, and`ufrac`

. This parameter is only visible when you select`User-defined`

for the**Output data type**parameter.**Set fraction length 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**Fraction length**parameter.

This parameter is only visible when you select

`Fixed-point`

for the**Output data type**parameter, or when you select`User-defined`

and the specified output data type is a fixed-point data type.**Fraction length**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 when you select

`Fixed-point`

or`User-defined`

for the**Output data type**parameter and`User-defined`

for the**Set fraction length in output to**parameter.

Double-precision floating point

Single-precision floating point

Fixed point

Boolean

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

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

Constant | Simulink |

Signal From Workspace | DSP System Toolbox |

Was this topic helpful?