Main Content

ufind

Find uncertain variables in Simulink model

Syntax

uvars = ufind('mdl')
[uvars,pathinfo] = ufind('mdl')
uvars = ufind(usys_1,usys_2,...)

Description

uvars = ufind ('mdl') finds Uncertain State Space blocks in the Simulink® model mdl. It returns a structure uvars that contains all uncertain variables associated with the Uncertain State Space blocks. Each uncertain variable is a ureal, umargin or ultidyn object and is listed by name in uvars.

[uvars,pathinfo] = ufind('mdl') returns a cell array pathinfothat contains paths to the Uncertain State Space blocks and the corresponding uncertain variables in the block. The first column of pathinfo lists the block paths through the model hierarchy and the second column lists the uncertain variables associated with the block. Use pathinfo to verify that all Uncertain State Space blocks in the model mdl have been identified.

uvars = ufind(usys_1,usys_2,...) collects all uncertain variables referenced by the uncertain model usys_n. usys_n can be uss or ufrd models. Use this syntax as an alternative to querying the model itself, when you know the uncertain models that the Uncertain State Space blocks use.

ufind can find Uncertain State Space blocks inside Masked Subsystems, Library Links, and Model References but not inside Accelerated Model References. ufind errors out if the same uncertain variable name has different definitions in the model. For example, if your model contains two Uncertain State Space blocks where the uncertain system variables define the same uncertain variable 'unc_par" as ultidyn('unc_par',[1 1]) and ureal('unc_par',5), such an error occurs.

Examples

Find all Uncertain State Space blocks and uncertain variables in a Simulink model:

  1. Open the Simulink model.

    open_system('usim_model')
    

    The model, as shown in the following figure, contains three Uncertain State Space blocks named Unmodeled Plant Dynamics, Plant, and Sensor Gain. These blocks depend on three uncertain variables named input_unc, unc_pole and sensor_gain.

  2. Use ufind to find all Uncertain State Space blocks and uncertain variables in the model.

    [uvars,pathinfo] = ufind('usim_model')
    
  3. Type uvars to view the structure uvars. MATLAB® returns the following result:

    uvars = 
    
          input_unc: [1x1 ultidyn]
        sensor_gain: [1x1 ureal]
           unc_pole: [1x1 ureal]
    

    Each uncertain variable is a ureal or ultidyn object and is listed by name in uvars.

  4. View the Uncertain State Space block paths and uncertain variables.

    1. Type pathinfo(:,1) to view paths of the Uncertain State Space blocks in the model. MATLAB returns the following result:

      ans = 
      
          'usim_model/Plant'
          'usim_model/Sensor Gain'
          'usim_model/Unmodeled Plant Dynamics'
      
    2. Type pathinfo(:,2) to view the uncertain variables referenced by each Uncertain State Space block. MATLAB returns the following results:

      ans = 
      
          'unc_pole'
          'sensor_gain'
          'input_unc'
      

Version History

Introduced in R2009b