Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Control Design   

Configuring the Linearization of Specific Blocks and Subsystems

Ways to Configure Blocks and Subsystems For Linearization

Most Simulink blocks are linear and do not require any special configuration. You can configure the linearization of the following blocks:

Controlling the Analytic 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.

Locating Blocks in Your Model That Do Not Support Analytic Linearization

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.

Specifying the Linearization of Blocks and Subsystems

You can specify the linearization of blocks, subsystems, or model references without replacing any blocks in your model using either:

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.

Specifying the Linearization Using a MATLAB Expression

To specify the linearization of a block, subsystem, or model reference using a MATLAB expression:

  1. Right-click the block in the Simulink model, and select Linear Analysis > Specify Linearization.

    The Block Linearization Specification dialog box opens.

  2. Check Specify block linearization using a.

  3. In the Specify block linearization using a drop-down, select MATLAB Expression.

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

Specifying the Linearization Using a Configuration Function

You can specify the linearization of a block, subsystem, or model reference using a configuration function. The function must:

To specify the linearization using a configuration function:

  1. Right-click the block in the Simulink model, and select Linear Analysis > Specify Linearization.

    The Block Linearization Specification dialog box opens.

  2. Check Specify block linearization using a.

  3. In the Specify block linearization using a drop-down, select Configuration Function.

  4. In the text field, enter a function to specify the linearization.

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

Controlling the Block Perturbation Linearization of Individual Blocks

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 Perturbation Size

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:

  1. Get the block's port handles:

    ph=get_param('magball/Magnetic Ball Plant','PortHandles')
    
  2. Next, get the inport:

    pin=ph.Inport(1)
    
  3. Finally, set the perturbation level for this inport:

    set_param(pin,'PerturbationForJacobian','1e-7')
    

Blocks Containing Two Inputs

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.

Model Reference Blocks

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.

Blocks with Nondouble Data Types

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.

Overriding Nondouble Data Types.  

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.

  


Related Products & Applications

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