| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Design Optimization |
| Contents | Index |
| Learn more about Simulink Design Optimization |
uncpar=randunc(N,'ParameterName',Range,...)
uncpar=randunc(N,'ParameterName',Range,...) generates random values of uncertain parameters, specified as comma separated 'ParameterName' and Range value pairs. Range specifies the lower and upper bounds for the uncertain parameter. Enter Range as a cell array {[Min],[Max]} for vector- and scalar-valued parameters or vector [Min,Max] for scalar-valued parameters. Dimensions of each cell element must match the corresponding parameter dimension. N is the number of samples inside the hypercube formed by Min and Max of each parameter. uncpar contains the uncertain parameter values.
Generate random values for vector-valued uncertain parameters Kp and Kd:
uset=randunc(10,'Kp',{[1,4,3,0],[4,10,7.5,6]},'Kd',{[2,2],[8,7]})
Generate random values for scalar-valued uncertain parameters w0 and zeta:
uset=randunc(4,'w0',[0.45,0.55],'zeta',[0.45,0.55])
Generate random values for uncertain parameters and test model robustness:
% Open the Simulink model.
sldo_model1_desreq_optim
% Extract response optimization project from the model.
proj=getsro('sldo_model1_desreq_optim');
% Create random values for uncertain parameters w0 and zeta.
uset=randunc(4,'w0',[0.45,0.55],'zeta',[0.45,0.55])
% View values for the uncertain parameter w0.
uset.w0
% The default value of the Optimized property of uset is false.
% This value implies that the uncertain parameter values are not
% enabled for testing model robustness.
% Set the value to true to enable all uncertain parameter
% values for testing model robustness.
uset.Optimized(1:end)=true;
% Specify parameter uncertainty in response optimization project.
setunc(proj,uset);
% Test model robustness.
optimize(proj);For parameters p with range specified as [Min,Max] or {[Min],[Max]} , randunc interprets the range of the uncertain parameters as:
Min(i,j) <= p(i,j) <= Max(i,j)
randunc generates a set of uncertain parameter values consists of the following:
All vertices of the hypercube specified by Min and Max values of the parameters. The total number of vertices of the hypercube is 2S, where S is the number of uncertain parameters.
N random samples inside the hypercube.
To generate random values of uncertain parameters using the GUI:
In the Simulink model, double-click the Signal Constraint block to open the Block Parameters: Signal Constraint window.
In the Block Parameters window, select Optimization > Uncertain Parameters to open the Uncertain Parameters dialog box.
Select Random (Monte Carlo) as the Sampling method.
Specify the number of samples in the Number of samples field.
Specify the uncertain parameters and their range:
Click Add to open the Add Parameters dialog box.
Select the uncertain parameters and click OK to add them to the Uncertain Parameters dialog box.
Specify the range for the corresponding parameter in the Min and Max columns.
![]() | optimset | setunc | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |