Accelerating the pace of engineering and science

# Documentation

## Check Parameter Values

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.

### Blocks That Perform Parameter Range Checking

The following blocks perform range checking for their parameters:

BlockParameters Checked

Constant

Constant value

Data Store Memory

Initial value

Gain

Gain

Interpolation Using Prelookup

Table data

1-D Lookup Table

Table data

2-D Lookup Table

Table data

n-D Lookup Table

Table data

Relay

Output when on
Output when off

Repeating Sequence Interpolated

Vector of output values

Repeating Sequence Stair

Vector of output values

Saturation

Upper limit
Lower limit

### Specify Ranges for Parameters

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).

 Note:   You cannot specify the minimum or maximum value as NaN, inf, or –inf.

#### Specifying Ranges for Complex Numbers

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))

### Perform Parameter Range Checking

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.

• In the Simulink Editor, when you start a simulation or select Simulation > Update Diagram, 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 Specify 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 Update a Block Diagram). Simulink displays the following error message: