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
, whereais 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
andtau
, and one tunable block,C
. SampleT
at 20 random(a,tau)
pairs.
Ts
is a 20-by-1 array ofgenss
models. The tunable blockC
, which is not sampled, is preserved inTs
. The structuresamples
has fieldssamples.a
andsamples.tau
that contain the values at which those blocks are sampled.
Groupinga
andtau
into a cell array causesrsampleBlock
to sample them together, as(a,tau)
pairs. Sampling the blocks independently generates a higher-dimensionality arrays. For example, independently taking 10 random samples ofa
and 5 samples oftau
generates a 10-by-5 model array.
TsInd = 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, "get(TsInd)" to see all properties, and "TsInd.Blocks" to interact with the blocks.
In this array,a
varies along one dimension andtau
varies along the other.