| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Control Design |
| Contents | Index |
| Learn more about Simulink Control Design |
Most Simulink blocks are linear and do not require any special configuration. You can configure the linearization of the following blocks:
Blocks with discontinuities, by setting any built-in block linearization options available, as described in Controlling the Analytic Linearization of Individual Blocks
Any block, subsystem, or model reference block, by specifying the actual linearization result, as described in Specifying the Linearization of Blocks and Subsystems.
Blocks that linearize using numerical perturbation, by defining perturbation levels, as described in Controlling the Block Perturbation Linearization of Individual Blocks
You can control the linearization of several types of blocks by adjusting options in the Block Parameters window. For example, you can change the order of the Padé approximation used in the Transport Delay block or select the Treat as gain when linearizing option in the Saturation block. For more information on controlling the linearization of individual blocks, see the reference page for each block.
You can view a list of the blocks in your model that automatically linearize using numerical perturbation instead of analytic linearization because they do not contain analytic Jacobians. View this list in the diagnostic messages tab for your linearization results in the Control and Estimation Tools Manager. For more information on this list, see Diagnosing Blocks in the Simulink Control Design documentation.
You can specify the linearization of blocks, subsystems, or model references without replacing any blocks in your model using either:
MATLAB Expressions, as described in Specifying the Linearization Using a MATLAB Expression
Configuration Functions, as described in Specifying the Linearization Using a Configuration Function
Specifying linearization does not affect the simulation of your model. You can specify how blocks linearize when you use the block-by-block analytic linearization method (the default). To set a linearization method, see Choosing Linearization Settings and Algorithms.
To specify the linearization of a block, subsystem, or model reference using a MATLAB expression:
Right-click the block in the Simulink model, and select Linear Analysis > Specify Linearization.
The Block Linearization Specification dialog box opens.
Check Specify block linearization using a.
In the Specify block linearization using a drop-down, select MATLAB Expression.
In the text field, enter an expression to specify the linearization. This expression must return one of the following results:
Linear model in the form of a D-matrix
Control System Toolbox LTI object
Robust Control Toolbox uncertain state space or uncertain real object (requires Robust Control Toolbox™ software)

Then, click OK.
When you linearize the model, the expression you enter follows the resolution rules of normal block, as described in Resolving Symbols.
For an example of specifying the linearization of a block using a MATLAB expression, see the Specifying Custom Linearizations for Simulink Blocks demo.
You can specify the linearization of a block, subsystem, or model reference using a configuration function. The function must:
Contain a single input argument blockdata, which is a structure with the following fields:
BlockName is the name of the Simulink block with the specified linearization.
Parameters is a structure array containing the evaluated values for the block. Each element of the array has the fields 'Name' and 'Value', which contain the name and evaluated value, respectively, for the parameter.
Inputs is an array of input values.
ny is the number of output channels of the block linearization.
nu is the number of input channels of the block linearization.
Returns one of the following results:
Linear model in the form of a D-matrix
Control System Toolbox LTI object
Robust Control Toolbox uncertain state space or uncertain real object (requires Robust Control Toolbox software)
To specify the linearization using a configuration function:
Right-click the block in the Simulink model, and select Linear Analysis > Specify Linearization.
The Block Linearization Specification dialog box opens.
Check Specify block linearization using a.
In the Specify block linearization using a drop-down, select Configuration Function.
In the text field, enter a function to specify the linearization.
In the table, add each parameter from your function
and a corresponding parameter value. Click
to add a
new parameter to the table. Click
to delete
a row from the table. Use the arrows to move parameters up and down
in the list.

Then, click OK. The parameters and values you specify automatically populate the Parameters field of the configuration function input argument structure blockdata.
To set the perturbation size of any blocks that linearize using block perturbation, see Changing Perturbation Size. To locate blocks in your model that linearize using block perturbation, see Locating Blocks in Your Model That Do Not Support Analytic Linearization.
You can also control the block perturbations of the following blocks using pre-configurations available in the block dialogs:
Changing the size of the
perturbations changes the linearization results. The default perturbation
size is 10-5(1+|x|),
where x is the operating point value of the state
or input being perturbed. For example, to change the perturbation
size of the states in the Magnetic Ball Plant block in the magball model
to
, type
blockname='magball/Magnetic Ball Plant' set_param(blockname,'StatePerturbationForJacobian','1e-7')
To change the perturbation size of the input of the Magnetic
Ball Plant block to
, where u is the
input signal level, follow these steps:
ph=get_param('magball/Magnetic Ball Plant','PortHandles')
pin=ph.Inport(1)
Finally, set the perturbation level for this inport:
set_param(pin,'PerturbationForJacobian','1e-7')
If there is more than one inport, you can choose to assign a different perturbation level to each. The following figure shows an S-Function block with two input signals, the actual signal and an index variable. To avoid perturbing the index signal, you can assign a perturbation level of 0 to this inport.

When linearizing model reference blocks with accelerated mode, the Simulink Control Design software automatically uses block perturbation. If you instead want to linearize these referenced models using block-by-block analytical linearization, then change the block mode from accelerated to normal.
Note Model blocks with multiple sample times and accelerated mode cannot be linearized using block perturbation. To linearize blocks with multiple sample times, you must set the block mode to normal. |
Note If your model contains multiple model blocks referencing the same Simulink model, you must set all of the blocks to accelerator mode. |
Blocks that have nondouble data type signals as either inputs or outputs, and which do not have a preprogrammed exact linearization, automatically linearize to zero as they cannot be numerically perturbed. For example, many logical operator blocks have Boolean outputs and therefore linearize to 0.
Workarounds for Blocks with Nondouble Data Types.To work around the problem of blocks with nondouble data types linearizing to zero, you can use a Data Type Conversion block. This block has a preprogrammed exact linearization, to convert your signals to doubles before linearizing the model. The following example illustrates this concept. The model in this example is configured to linearize the Square block at an operating point where the input is 1. The resulting linearized model should be 2, but the input to the Square block is Boolean and the linearization is zero.

However, by inserting a Data Type Conversion block before the linearization input point, you can make the input signal to the Square block a double. Thus, the linearized model gives the correct response of 2.

When you linearize a model that contains nondouble data types but still runs correctly in full double precision, you can choose to override all data types with doubles. To perform this override, in the model window select Tools > Fixed-Point > Fixed-Point Tool from the menu. This selection opens the Fixed-Point Settings window. Within this window select True doubles from the Data type override menu. Now, when you linearize and simulate the model, it uses doubles for all data types.
Note This method does not work when the model relies on other data types in its algorithm, such as relying on integer data types to perform truncation from floats. |
![]() | Choosing Linearization Settings and Algorithms | Selecting Inputs and Outputs for the Linearized Model | ![]() |

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