Robustness Analysis in Simulink

This example shows how to use Simulink® blocks and helper functions provided by Robust Control Toolbox™ to specify and analyze uncertain systems in Simulink and how to use these tools to perform Monte Carlo simulations of uncertain systems.

Introduction

The Simulink model usim_model consists of an uncertain plant in feedback with a sensor:

Simulink Blocks for Uncertainty Modeling and Analysis

The RCTblocks library contains blocks to model and analyze uncertainty effects in Simulink. To open the library, type

open('RCTblocks')

The Uncertain State Space block lets you specify uncertain linear systems (USS objects). usim_model contains three such blocks which are highlighted in blue. The dialog for the "Plant" block appears below.

The "Uncertainty value" parameter specifies values for the block's uncertain variables (unc_pole in this case).

uval is a structure whose field names and values are the uncertain variable names and values to use for simulation. You can set uval to [] to use nominal values for the uncertain variables or vary uval to analyze how uncertainty affects the model responses.

The MultiPlot Graph block is a convenient way to visualize the response spread as you vary the uncertainty. This block superposes the simulation results obtained for each uncertainty value.

Monte Carlo Simulation of Uncertain Systems

To easily control the uncertainty value used for simulation, usim_model uses the same "Uncertainty value" uval in all three Uncertain State Space blocks. Setting uval to [] simulates the closed-loop response for the nominal values of unc_pole, input_unc, and sensor_gain:

To analyze how uncertainty affects the model responses, you can use the ufind and usample commands to generate random values of unc_pole, input_unc, and sensor_gain. First use ufind to find the Uncertain State Space blocks in usim_model and compile a list of all uncertain variables in these blocks:

Then use usample to generate uncertainty values uval consistent with the specified uncertainty ranges. For example, you can simulate the closed-loop response for 10 random values of unc_pole, input_unc, and sensor_gain as follows:

The MultiPlot Graph window now shows 10 possible responses of the uncertain feedback loop. Note that each uval instance is a structure containing values for the uncertain variables input_unc, sensor_gain, and unc_pole:

Randomized Simulations

If needed, you can configure the model to use a different uncertainty value uval for each new simulation. To do this, add uvars to the Base or Model workspace and attach the usample call to the model InitFcn:

Linearization of Uncertain Simulink Models

If you have Simulink Control Design™, you can use the same workflow to linearize and analyze uncertain systems in the frequency domain. For example, you can plot the closed-loop Bode response for 10 random samples of the model uncertainty: