This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Specifying Custom Linearizations for Simulink Blocks

This example shows how to specify the linearization of a Simulink block or subsystem.


The command LINEARIZE in Simulink Control Design gives a linear approximation of a Simulink model using an exact linearization approach. This linearization is valid in a small region around a given operating point. This approach works well for most Simulink models, but in some cases you need to modify the exact linearization approach to take into account the effects of discontinuities or approximate the dynamics of derivative or delay action. Many built-in Simulink blocks, such as saturation or the dead zone non-linearities, provide the ability to select "Treat as gain when linearizing" to control this behavior. In this example you specify a custom linearization for a subsystem to approximate the linearization of a PWM signal.

Linearizing a Model with a PWM Generation Subsystem

The following example model has a subsystem scdpwm/Voltage to PWM, which models a PWM signal that enters a plant model.

mdl = 'scdpwm';

When you linearize this model using the standard configuration, the resulting linear model has a gain of zero.

io = getlinio(mdl);
sys = linearize(mdl,io)
sys =
  D = 
   Plant Model     0
Static gain.

The block scdpwm/Voltage to PWM/Compare To Zero causes this linearization to be zero.

pwmblk = 'scdpwm/Voltage to PWM';

The linearization is zero because the block represents is a pure discontinuous non-linearity.

u = [-1:0.1:0,0:0.1:1];
y = [zeros(11,1);ones(11,1)];
xlabel('Block Input - u')
ylabel('Block Output - y')
ylim([-0.1 1.1]);

Specifying a Custom Linearization for the PWM Subsystem

With Simulink Control Design, you can control the linearization of the blocks in a Simulink model. You can specify the linearization of a block using:

  • Matrices

  • Linear time invariant models, such as transfer functions or state space

  • Robust Control uncertain parameters/state space models

In this example, the PWM subsystem contains a time delay

$$PWM(s) = e^{-sT_s}$$

This time delay accounts for the duty cycle frequency of the PWM signal which is at 100 Hz. To specify the delay on the subsystem scdpwm/Voltage to PWM right click on the block and select Linear Analysis->Specify Linearization. The following block dialog in which you to specify the delay dynamics opens.

The following code is equivalent to entering the delay into the specification dialog.

rep = struct('Specification','ss(1,''OutputDelay'',1/100)',...

Linearizing the model with the specified subsystem linearization now gives the expected result.

opt = linearizeOptions('SampleTime',0);
sys = zpk(linearize(mdl,io,opt))
sys =
  From input "Step" to output "Plant Model":
  exp(-0.01*s) * -------------
                 (s^2 + s + 1)
Continuous-time zero/pole/gain model.

Comparing the Linearization and Simulation

You can compare the linearization of the model to the actual linearization using a frest.createStep signal. It is important to note that the specification of the linearization does not need to be removed to simulate using the original model configuration. The linearization specification does not have an impact on simulation, only linearization. Visual inspection shows that the linearization accurately represents the dynamics.

instep = frest.createStep('Ts',1/10000,'StepTime',1,...
[sysf,simoutstep] = frestimate(mdl,io,instep);
legend('Linearization with PWM Subsystem Specification',...
            'Simulated Step Response','Location','East')

Other Applications of Specifying Custom Linearizations for Simulink Blocks

Block linearization specification is not limited to linear time invariant models. With the Robust Control Toolbox, you can specify uncertain parameters and uncertain state space (USS) models for blocks in a model. The resulting linearization is then an uncertain model. The example "Linearization of Simulink models with Uncertainty" shows how to compute a linearization with uncertainty (Requires Robust Control Toolbox).

You can also perform analysis of models with discrete controllers and continuous plant dynamics in the continuous domain. See the example "Modeling Computational Delay and Sampling Effects" for more details.

Close the Simulink model.

Was this topic helpful?