sdo.sample

Generate parameter samples

Description

example

x = sdo.sample(ps) generates samples using the specified parameter space definition, ps. The output sample table, x, has 2Np+1 rows and Np columns. Each column corresponds to a parameter and each row corresponds to a sample of the parameters. Np is the number of parameters in ps. The samples are generated as per the ParameterDistributions, RankCorrelation, and Options property of ps.

example

x = sdo.sample(ps,N) specifies the number of samples to be generated. x is a table with N rows and Np columns.

example

x = sdo.sample(___,opt) specifies sampling options such as the sampling method. This syntax can include any of the input argument combinations in the previous syntaxes.

Examples

collapse all

Open the model.

open_system('sdoHydraulicCylinder');

Obtain the parameters from the model.

p = sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','K'});

Create an sdo.ParameterSpace object to specify the sample distributions.

ps = sdo.ParameterSpace(p);

Generate samples for the parameters.

x = sdo.sample(ps);

Open the model.

open_system('sdoHydraulicCylinder');

Obtain the parameters from the model.

p = sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','K'});

Create an sdo.ParameterSpace object to specify the sample distributions.

ps = sdo.ParameterSpace(p);

Generate 50 samples for the parameters.

x = sdo.sample(ps,50);

Open the model.

open_system('sdoHydraulicCylinder');

Obtain the parameters from the model.

p = sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','K'});

Create an sdo.ParameterSpace object to specify the sample distributions.

ps = sdo.ParameterSpace(p);

Specify the sampling method as Latin hypercube.

opt = sdo.SampleOptions;
opt.Method = 'lhs';

Generate 50 samples for the parameters using Latin hypercube sampling.

x = sdo.sample(ps,50,opt);

Input Arguments

collapse all

Parameter space distribution definition, specified as an sdo.ParameterSpace object.

Number of samples to be generated for the parameters, specified as a positive integer.

Ideally, you want to use the smallest number of samples that yield useful results, because each sample requires a model evaluation.

As the number of parameters increases, the number of samples needed to explore the design space generally increases. For correlation or regression analysis, consider using 10Np samples, where Np is the number of parameters.

Example: 10

Sampling options, specified as an sdo.SampleOptions object.

Output Arguments

collapse all

Parameter samples, returned as a table.

x has Ns rows and Np columns. Each column corresponds to a parameter and each row corresponds to a sample of the parameters. Np is the number of parameters in ps. If you specify N, Ns is equal to N. Otherwise, Ns is equal to 2Np+1.

Introduced in R2014a