## Documentation Center |

On this page… |
---|

Derive Ranges Using Design Ranges Derive Ranges Using Block Initial Conditions Derive Ranges Using Design Ranges for Simulink.Parameter Objects Insufficient Design Range Information |

This example shows how the range analysis narrows the derived
range for the Outport block. This range is based on
the range derived for the **Add** block using the
design ranges specified on the two Inport blocks and
the design range specified for the Add block.

Open the

`ex_derived_min_max_1`model. At the MATLAB^{®}command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_derived_min_max_1

The model displays the specified design minimum and maximum values for each block.

`In1`design range is`[-50..100]`.`In2`design range is`[-50..35]`.Add block design range is

`[-125..55]`.

From the Simulink

^{®}**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.This global override of the fixed-point data types using double-precision numbers avoids quantization effects.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.To calculate the derived range at the Add block input, the software uses the design minimum and maximum values specified for the Inport blocks,

`[-50..100]`and`[-50..35]`. The derived range at the Add block input is`[-85..150]`.In the

**Contents**pane, the Fixed-Point Tool displays the derived and design minimum and maximum values for the blocks in the selected system.The derived range for the Add block output signal is narrowed to

`[-85..55]`. This derived range is the intersection of the range derived from the block inputs,`[-85..150]`, and the design minimum and maximum values specified for the block output,`[-125..55]`.The derived range for the Outport block

`Out1`is`[-85..55]`, the same as the Add block output.

This example shows how range analysis takes into account block initial conditions.

Open the

`ex_derived_min_max_2`model. At the MATLAB command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_derived_min_max_2

The model uses block annotations to display the specified design minimum and maximum values for the Inport block and the initial conditions for the Unit Delay block.

`In1`design range is`[5..10]`.Unit Delay block initial condition is

`0`.

From the Simulink

**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.This global override of the fixed-point data types using double-precision numbers avoids quantization effects.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.In the

**Contents**pane, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the model.The derived minimum and maximum range for the Outport block,

`Out1`, is`[0..10]`. The range analysis derives this range by taking the union of the initial value,`0`, on the Unit Delay block and the design range on the block,`[5..10]`.Change the initial value of the Unit Delay block to

`7`.Double-click the Unit Delay block.

In the

**Block Parameters**dialog box, set**Initial conditions**to`7`, then click**OK**.In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.Because the analysis takes the union of the initial conditions,

`7`, and the design range,`[5..10]`, on the Unit Delay block, the derived range for the block is still`[5..10]`.

This example shows how the range analysis takes into account
design range information for `Simulink.Parameter` objects
unless the parameter storage class is set to Auto. If the parameter
storage class is set to Auto, the analysis uses the value of the parameter.

Open the

`ex_derived_min_max_3`model. At the MATLAB command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_derived_min_max_3

The model displays the specified design minimum and maximum values for the Inport blocks. The design range for both Inport blocks is

`[1..2]`.Examine the gain parameters for the Gain blocks.

Double-click each Gain block and note the name of the Gain parameter on the Main tab.

Gain Block Gain Parameter `Gain1``paramObjOne``Gain2``paramObjTwo`From the model menu, select

**Tools**>**Model Explorer**.In Model Explorer window, select the base workspace and view information for each of the gain parameters used in the model.

Gain Parameter Type Information `paramObjOne``Simulink.Parameter`object. Value`2`. Storage class set to`Auto`.`paramObjTwo``Simulink.Parameter`object. Value`2`. Storage class set to`SimulinkGlobal`.

From the Simulink

**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.This global override of the fixed-point data types using double-precision numbers avoids quantization effects.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.In the

**Contents**pane, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the model.Block Derived Range Reason `Gain1``[2..4]`The gain parameter,

`paramObjOne`, specified on Gain block`Gain1`is a`Simulink.Parameter`object that has its storage class specified as`Auto`. The range analysis uses the**value**of the`Simulink.Parameter`object, which is`2`, and ignores the design range specified for these parameters.`Gain2``[1..20]`The gain parameter,

`paramObjTwo`, specified on Gain block`Gain2`is a`Simulink.Parameter`object that has its storage class specified as`SimulinkGlobal`. The range analysis takes into account the design range,`[1..10]`, specified for this parameter.

This example shows that if the analysis cannot derive range information because there is insufficient design range information, you can fix the issue by providing additional input design minimum and maximum values.

Open the

`ex_derived_min_max_4`model. At the MATLAB command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_derived_min_max_4

The model displays the specified design minimum and maximum values for the blocks in the model.

The Inport block

`In1`has a design minimum of`-1`but no specified maximum value, as shown by the annotation,`Max=[]`.The Gain block has a design range of

`[-1.5..1.5]`.The Outport block

`Out1`has no design range specified, as shown by the annotations,`Min=[]`,`Max=[]`.

From the Simulink

**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.In the

**Contents**pane, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the model. The range analysis is unable to derive a maximum value for the Inport block,`In1`. The tool highlights this result.To fix the issue, specify a design maximum value for

`In1`:In the model, double-click the Inport block,

`In1`.In the block parameters dialog box, select the

**Signal Attributes**tab.On this tab, set

**Maximum**to`1`and click**OK**.The model displays the updated maximum value in the block annotation for

`In1`.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button to rerun the range analysis.The range analysis can now derive ranges for the Inport and Gain blocks.

Block Derived Range Reason Inport

`In1``[-1..1]`Uses specified design range on the block.

Gain

`[-1.5..1.5]`The design range specified on the Gain block is

`[-1.5..1.5]`. The derived range at the block input is`[-1..1]`(the derived range at the output of`In1`). Therefore, because the gain is`2`, the derived range at the Gain block output is the intersection of the propagated range,`[-2..2]`, and the design range,`[-1.5..1.5]`.Outport

`In2``[-1.5..1.5]`Same as Gain block output because no locally specified design range on Outport block.

This example shows that if the analysis cannot derive range information because there is insufficient design range information, you can fix the issue by providing additional output design minimum and maximum values.

Open the

`ex_derived_min_max_5`model. At the MATLAB command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_derived_min_max_5

The model displays the specified design minimum and maximum values for the blocks in the model.

The Inport block

`In1`has a design range of`-10,20`.The rest of the blocks in the model have no specified design range.

From the Simulink

**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.In the

**Contents**pane, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the model. Because one of the Add block inputs is fed back from its output, the analysis is unable to derive an output range for the Add block or for any of the blocks connected to this output. The Fixed-Point Tool highlights these results.To fix the issue, specify design minimum and maximum values for

`Out1`:In the model, double-click the Outport block,

`Out1`.In the block parameters dialog box, select the

**Signal Attributes**tab.On this tab, set

**Minimum**to`-20`and**Maximum**to`40`and click**OK**.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button to rerun the range analysis.The range analysis uses the minimum and maximum values specified for

`Out1`,`[-20..40]`and the gain value of`Gain3`,`2`, to derive an input range for`Gain3`,`[-10..20]`. Because the input of`Gain3`feeds back to the input of the Add block, the analysis now derives ranges for all objects in the model.

This example shows how to fix design range conflicts. If you specify conflicting design minimum and maximum values in your model, the range analysis software reports an error. To fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. Modify them to make them consistent. In this example, the output design range specified on the Outport block conflicts with the input design ranges specified on the Inport blocks.

Open the

`ex_range_conflict`model. At the MATLAB command line, enter:addpath(fullfile(docroot,'toolbox','fixpoint','examples')) ex_range_conflict

The model displays the specified design minimum and maximum values for the blocks in the model.

The Inport blocks

`In1`and`In2`have a design range of`[-1..1]`.The Outport block

`Out1`has a design range of`[10..20]`.

From the Simulink

**Analysis**menu, select**Fixed-Point Tool**.In the

**Settings for selected system**pane, set**Data type override**to`Double`, then click**Apply**.In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button.The Fixed-Point Tool generates an error because the range analysis fails. It reports an error because the derived range for the Sum block,

`[-2..2]`is outside the specified design range for the Outport block,`[10..20]`.Close the error dialog box.

To fix the conflict, change the design range on the Outport block to

`[-10..20]`so that this range includes the derived range for the Sum block.In the model, double-click the Outport block.

In the block parameters dialog box, click the

**Signal Attributes**tab.On this tab, set

**Minimum**to`-10`and click**OK**.

In the Fixed-Point Tool, click the

**Derive min/max values for selected system**button to rerun the range analysis.The range analysis derives a minimum value of

`-2`and a maximum value of`2`for the Outport block.

Was this topic helpful?