| Contents | Index |
| On this page… |
|---|
Blocks That Perform Parameter Range Checking |
Many blocks perform range checking of their mathematical parameters. Generally, blocks that allow you to enter minimum and maximum values check to ensure that the values of applicable parameters lie within the specified range.
The following blocks perform range checking for their parameters:
| Block | Parameters Checked |
|---|---|
Constant value | |
Initial value | |
Gain | |
Table data | |
Table data | |
Table data | |
Table data | |
Output when on | |
Vector of output values | |
Vector of output values | |
Upper limit |
In general, use the Output minimum and Output maximum parameters that appear on a block parameter dialog box to specify a range of valid values for the block parameters. The following exceptions apply:
For the Gain block, use the Parameter minimum and Parameter maximum fields to specify a range for the Gain parameter.
For the Data Store Memory block, use the Minimum and Maximum fields to specify a range for the Initial value parameter.
When specifying minimum and maximum values that constitute a range, enter only expressions that evaluate to a finite, scalar, real number with double data type. The default values for the minimum and maximum are [] (unspecified). The scalar values that you specify are subject to expansion, for example, when the block parameters that Simulink checks are nonscalar (see Scalar Expansion of Inputs and Parameters).
When you specify a minimum or maximum value for a parameter that is a complex number, the specified minimum and maximum apply separately to the real part and to the imaginary part of the complex number. If the value of either part of the number is less than the minimum, or greater than the maximum, the complex number is outside the specified range. No range checking occurs against any combination of the real and imaginary parts, such as (sqrt(a^2+b^2))
You can initiate parameter range checking in the following ways:
When you click the OK or Apply button on a block parameter dialog box, the block performs range checking for its parameters. However, the block checks only the parameters that it can readily evaluate. For example, the block does not check parameters that use an undefined workspace variable.
When you start a simulation or select Update Diagram from the Simulink Edit menu, Simulink performs parameter range checking for all blocks in that model.
Simulink performs parameter range checking by comparing the values of applicable block parameters with both the specified range (see Specifying Ranges for Parameters) and the block data type. That is, Simulink performs the following check:
DataTypeMin ≤ MinValue ≤ VALUE ≤ MaxValue ≤ DataTypeMax
where
DataTypeMin is the minimum value representable by the block data type.
MinValue is the minimum value the block should output, specified by, e.g., Output minimum.
VALUE is the numeric value of a block parameter.
MaxValue is the maximum value the block should output, specified by, e.g., Output maximum.
DataTypeMax is the maximum value representable by the block data type.
When Simulink detects a parameter value that violates the check, it displays an error message. For example, consider a model that contains a Constant block whose
Constant value parameter specifies the variable const, which you have yet to define in a workspace.
Output minimum and Output maximum parameters are set to 2 and 8, respectively.
Output data type parameter is set to uint8.
In this situation, Simulink does not perform parameter range checking when you click the OK button on the Constant block dialog box because the variable const is undefined. But suppose you define its value by entering
const = 10
at the MATLAB prompt, and then you update the diagram (see Updating a Block Diagram). Simulink displays the following error message:

![]() | Specifying Parameter Values | Using Tunable Parameters | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |