This example shows the workflow for varying uncertainty values using individual Uncertain State Space blocks in a Simulink® model. Use this approach for simple models with few uncertain variables or one Uncertain State Space block.
This section uses a simple Simulink model to provide step-by-step instructions for:
Toggling between nominal, manually defined and randomly-generated uncertainty values associated with the Uncertain State Space block.
Simulating the model's responses for these uncertainty values.
Open the Simulink model
The model contains an Uncertain State Space block called
Uncertain System, as shown in the following figure.
Uncertain System block to open
the Function Block Parameters dialog box.
Uncertain System block uses the uncertain system variable
unc_sys. This variable is defined in the Model workspace as
unc_sys= ss(ureal('a',-1,'Range',[-2 -.5]),1,5,0)*(1+0.1*input_unc).
The uncertain model depends on a single uncertain variable named
Uncertainty value field specifies to use nominal value
of the uncertain variable
Click OK to close the dialog box.
Click to simulate the model.
The software uses the nominal value of
a during simulation. After
the simulation completes, the MultiPlot Graph shows the following plot.
To simulate the model using a manually defined value of
Double-click the Uncertain State Space block, and enter
struct('a',-0.3) in the Uncertainty
to simulate the model.
The MultiPlot Graph shows the following responses,
corresponding to the nominal and manually-defined values of
Pick a random value of
a in its uncertainty
range. To do so, double-click the Uncertain State Space block, and type
usample(ufind(unc_sys)) in the Uncertainty
Analyze the uncertainty effects by simulating the model ten times using the following commands:
for i=1:10; sim('rct_sim_ex1',10); end
During simulation, the software samples the uncertain variable
its uncertainty range [-2 -0.5] and shows the simulated response for each sample value.
The plots cycle through seven different colors, and the last response appears in
Tip: You can clear the plots in the MultiPlot Graph block before you run the simulation.