Take random samples of a model with both tunable and uncertain blocks. Using uncertain blocks requires Robust Control Toolbox™. Random sampling of tunable blocks works the same way as shown in this example.
Create an uncertain model of , where a is an uncertain parameter that varies in the interval [3,5], and = 0.5 +/- 30%. Also, create a tunable PI controller, and form a closed-loop system from the tunable controller and uncertain system.
T is a generalized state-space model with two uncertain blocks, a
and tau
, and one tunable block, C
. Sample T
at 20 random (a,tau)
pairs.
Ts
is a 20-by-1 array of genss
models. The tunable block C
, which is not sampled, is preserved in Ts
. The structure samples
has fields samples.a
and samples.tau
that contain the values at which those blocks are sampled.
Grouping a
and tau
into a cell array causes rsampleBlock
to sample them together, as (a,tau)
pairs. Sampling the blocks independently generates a higher-dimensionality arrays. For example, independently taking 10 random samples of a
and 5 samples of tau
generates a 10-by-5 model array.
10x5 array of generalized continuous-time state-space models.
Each model has 1 outputs, 1 inputs, 2 states, and the following blocks:
C: Tunable PID controller, 1 occurrences.
Type "ss(TsInd)" to see the current value and "TsInd.Blocks" to interact with the blocks.
In this array, a
varies along one dimension and tau
varies along the other.