Products & Services Solutions Academia Support User Community Company


usample

Purpose

Generate random samples of uncertain variables

Syntax

Description

samples = usample(uvars,N) generates N random samples of the uncertain variables in uvars. uvars is a structure that lists uncertain variables (ureal, ucomplex or ultidyn) by name. You can automatically obtain uvars for a Simulink model that contains Uncertain State Space blocks using ufind. samples is an N-by-1 structure array whose field names and values are the names and sample values of the uncertain variables. Use this syntax, together with ufind, to generate random samples for uncertain variables in Simulink models.

samples = usample(uvars) is equivalent to usample(uvars,1).

samples = usample(uvars,N,Wmax) specifies constraints, as described in uss/usample, for sampling uncertain variables of type ultidyn in uvars.

Examples

Example 1

Generate random samples of uncertain variables:

Example 2

Generate random samples of uncertain variables in a Simulink model:

  1. Open the Simulink model.

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

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

  1. uvars = ufind('usim_model');

  1. Use usample to generate random samples of unc_pole, input_unc, and sensor_gain and simulate the closed-loop response.

  1. The MultiPlot Graph block displays the simulated responses, as shown in the following figure.

See Also

ufind, usubs, ureal, ucomplex, ultidyn, umat, ufrd, uss, uss/usample

Tutorials

Varying Uncertainty Values Using Individual Uncertain State Space Blocks

Varying Uncertainty Values Across Multiple Uncertain State Space Blocks

Robustness Analysis in Simulink

How To

"Simulating Uncertainty Effects  


 Provide feedback about this page 

Previous page uss/usample usimfill Next page

Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS