| Simulink® | ![]() |
Sources

The Constant block generates a real or complex constant value. The block generates scalar (one-element array), vector (1-D array), or matrix (2-D array) output, depending on the dimensionality of the Constant value parameter and the setting of the Interpret vector parameters as 1-D parameter. Also, the block can generate either a sample-based or frame-based signal, depending on the setting of the Sampling mode parameter.
The output of the block has the same dimensions and elements as the Constant value parameter. If you specify a vector for this parameter, and you want the block to interpret it as a vector (i.e., a 1-D array), select the Interpret vector parameters as 1-D parameter; otherwise, the block treats the Constant value parameter as a matrix (i.e., a 2-D array).
By default, the Constant block outputs a signal whose data type and complexity are the same as that of the block's Constant value parameter. However, you can specify the output to be any data type supported by Simulink® software, including fixed-point data types.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink®.
The Main pane of the Constant block dialog appears as follows:

Opening this dialog box causes a running simulation to pause. See Changing Source Block Parameters During Simulation.
Specify the constant value output by the block. You can enter any MATLAB® expression in this field, including the Boolean keywords, true or false, that evaluates to a matrix value. The Constant value parameter is converted from its data type to the specified output data type offline using round-to-nearest and saturation.
If you select this check box, the Constant block outputs a vector of length N if the Constant value parameter evaluates to an N-element row or column vector, i.e., a matrix of dimension 1xN or Nx1. If you uncheck this option, you can interact with the Sampling mode parameter. See Determining the Output Dimensions of Source Blocks.
Specify whether the output signal is Sample based or Frame based. For more information about these types of signals, see Sample-Based Signals and Frame-Based Signals in the Signal Processing Blockset™ User's Guide.
Note To generate frame-based signals, you must have the Signal Processing Blockset product installed. |
Specify the interval between times that the Constant block's output can change during simulation (e.g., as a result of tuning its Constant value parameter). The default sample time is inf, i.e., the block's output can never change. This setting speeds simulation and generated code by avoiding the need to recompute the block's output. See Specifying Sample Time.
The Signal Attributes pane of the Constant block dialog appears as follows:

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via back propagation
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, float('single')
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Output
data type parameter.
See Specifying Block Output Data Types for more information.
Direct Feedthrough | N/A |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | No |
Dimensionalized | Yes |
Multidimensionalized | Yes |
Zero Crossing | No |
![]() | Configurable Subsystem | Coulomb and Viscous Friction | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |