| Using Simulink | ![]() |
Working with Tunable Parameters
Simulink lets you change the values of many block parameters during simulation. Such parameters are called tunable parameters. In general, only parameters that represent mathematical variables, such as the Gain parameter of the Gain block, are tunable. Parameters that specify the appearance or structure of a block, e.g., the number of inputs of a Sum block, or when it is evaluated, e.g., a block's sample time or priority, are not tunable. You can tell whether a particular parameter is tunable by examing its edit control in the block's dialog box or Model Explorer during simulation. If the control is disabled, the parameter is disable.
| Note As a model optimization, you can declare even tunable parameters as nontunable. See Inlining Parameters for more information. |
Tuning Block Parameters
You can use a block's dialog box or the Model Explorer to modify the tunable parameters of any block, except a source block (see Changing Source Block Parameters). You can also use the MATLAB Command Line to tune block parameters.
To use the block's parameter dialog box, open the block's parameter dialog box, change the value displayed in the dialog box, and click the dialog box's OK or Apply button. You can use the set_param command to change the value of a block parameter at the MATLAB Command Line during simulation. Or, if the model uses a MATLAB workspace variable to specify the parameter's value, you can change the parameter's value by assigning a new value to the variable. In either case, you must update the model's block diagram for the change to take effect.
Changing Source Block Parameters
Opening the dialog box of a source block with tunable parameters (see Source Blocks with Tunable Parameters) causes a running simulation to pause. While the simulation is paused, you can edit the parameter values displayed on the dialog box. However, you must close the dialog box to have the changes take effect and allow the simulation to continue. Similarly, starting a simulation causes any open dialog boxes associated with source blocks with tunable parameters to close.
The Model Explorer disables the parameter fields that it displays in the list view and the dialog pane for a source block with tunable parameters while a simulation is running. As a result, you cannot use the Model Explorer to change the block's parameters. However, while the simulation is running, the Model Explorer displays a Modify button in the dialog view for the block. Clicking the Modify button opens the block's dialog box. Note that this causes the simulation to pause. You can then change the block's parameters. You must close the dialog box to have the changes take effect and allow the simulation to continue. Your changes appear in the Model Explorer after you close the dialog box.
Source Blocks with Tunable Parameters. Source blocks with tunable parameters include the following blocks.
| Working with Block Parameters | Inlining Parameters | ![]() |
© 1994-2005 The MathWorks, Inc.