Blocks

Customize block behavior by setting block parameters

To create a Simulink® model, you add blocks to a block diagram, and then connect and configure those blocks. You can assign values to numeric block parameters, which control block calculations during simulation, and adjust block properties, which control appearance.

Adjust the parameters and properties of blocks to:

  • Experiment with parameter values as you design a model.

  • Match simulation results with measured data by estimating parameter values.

  • Design an efficient control algorithm by optimizing parameter values.

  • Document blocks and customize appearance.

Define system constants by creating global variables that you can share between blocks and models.

Functions

set_paramSet system and block parameter values
get_paramGet parameter names and values
slexprGenerate expression to use in value of parameter object

Classes

Simulink.DualScaledParameterSpecify name, value, units, and other properties of Simulink dual-scaled parameter
Simulink.ParameterStore, share, and configure parameter values

Topics

Block Parameters

Set Block Parameter Values

Blocks have numeric parameters that determine how they calculate output values. To control the calculations that blocks perform, you can specify parameter values.

Share and Reuse Block Parameter Values by Creating Variables

To set multiple block parameters to the same value, you can use a numeric variable that you create and store in a workspace such as the base workspace, a model workspace, or a data dictionary.

Parameter Interfaces for Reusable Components

For each block parameter in a reusable component, specify the same value for all instances of the component or a different value for each instance.

Organize Related Block Parameter Definitions in Structures

Increase model readability and reduce the effort of model maintenance by aggregating block parameter values into structures.

Tune and Experiment with Block Parameter Values

As you construct a model you can experiment with block parameters, such as the coefficients of a Transfer Fcn block, to help you decide which blocks to use.

Optimize, Estimate, and Sweep Block Parameter Values

Use parameter sweeping to tune control parameters, estimate unknown model parameters, and test the robustness of a control algorithm by taking into consideration uncertainty in the real-world system.

Switch Between Sets of Parameter Values During Simulation and Code Execution

Switch between independent sets of values for the same block parameters by storing the sets in an array of structures.

Control Block Parameter Data Types

Control the data type that Simulink and the generated code use to store block parameter values in computer memory.

Specify Minimum and Maximum Values for Block Parameters

Fully specify your design and optimize the generated code by setting minimum and maximum values for numeric block parameters.

Block-Specific Parameters

To write scripts that create and modify models, determine the programmatic name of a parameter or property in a block dialog box.

Block Properties

Specify Block Properties

Control block appearance and add custom documentation to blocks. Specify block execution order and callbacks.

Associating User Data with Blocks

Associate your own data, such as a numeric variable, with a block.

Related Information

Featured Examples