This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Change Perturbation Level of Blocks Perturbed During Linearization

Blocks that do not have preprogrammed analytic Jacobians linearize using numerical perturbation.

Change Block Perturbation Level

This example shows how to change the perturbation level to the Magnetic Ball Plant block in the magball model. Changing the perturbation level changes the linearization results.

The default perturbation size is 10-5(1+|x|), where x is the operating point value of the perturbed state or the input.

Open the model before changing the perturbation level.

To change the perturbation level of the states to 107(1+|x|), where x is the state value, type:

blockname='magball/Magnetic Ball Plant'
set_param(blockname,'StatePerturbationForJacobian','1e-7')

To change the perturbation level of the input to 107(1+|x|), where x is the input signal value:

  1. Open the system and get the block port handles.

    sys = 'magball';
    open_system(sys)
    blockname = 'magball/Magnetic Ball Plant';
    ph = get_param(blockname,'PortHandles')
    
  2. Get the handle to the inport value.

    p_in = ph.Inport(1)
    
  3. Set the inport perturbation level.

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

Perturbation Levels of Integer Valued Blocks

A custom block that requires integer input ports for indexing might have linearization issues when this block:

  • Does not support small perturbations in the input value

  • Accepts double-precision inputs

To fix the problem, try setting the perturbation level of such a block to zero (which sets the block linearization to a gain of 1).