Vary Uncertainty Values Using Individual Uncertain State Space Blocks

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.

  1. Open the Simulink model rct_sim_ex1.
    rct_sim_ex1

    The model contains an Uncertain State Space block called Uncertain System, as shown in the following figure.

  2. Double-click the Uncertain System block to open the Function Block Parameters dialog box.

    The 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 a. The Uncertainty value field specifies to use nominal value of the uncertain variable a.

    Click OK to close the dialog box.

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

  4. To simulate the model using a manually defined value of a:

    1. Double-click the Uncertain State Space block, and enter struct('a',-0.3) in the Uncertainty value field.

    2. Click

      to simulate the model.

    The MultiPlot Graph shows the following responses, corresponding to the nominal and manually-defined values of a.

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

  6. 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 a in 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 red.

    Tip: You can clear the plots in the MultiPlot Graph block before you run the simulation.

See Also

|

Related Topics