Main Content


Options for sampling gridded parameters with sdo.sample

Since R2023a


    Specify method options for using sdo.sample to generate gridded parameter samples for sensitivity analysis.


    When you create an sdo.GriddedSpace object to specify parameters for gridded sampling, the Options property is an sdo.GriddingOptions object. You can also create an sdo.GriddingOptions directly using the sdo.GriddingOptions command. If you use the sdo.GriddingOptions object as an input to sdo.sample when sampling a gridded parameter space, it overrides the method specified in the Options property of the sdo.GriddedSpace object.



    opt = sdo.GriddingOptions creates an options set for sampling parameter spaces and assigns default values to its properties. Use dot notation to modify the property values.


    expand all

    Sampling method, specified as one of the following values:

    • 'exhaustive' — Sample set returned by sdo.sample includes all possible combinations of parameter values. For instance, for parameters A with values {1 2 3} and B with values {-10 -20 -30 -40}, the sample set contains all twelve combinations (1, -10), (1, -20), (1, -30), …, (3, -20), (3, -30), (3, -40).

    • 'sequential' — Sample set contains only pairwise combinations of parameters. For instance, for parameters A, B, and C with N values each, the sample set contains only the combinations (A1, B1, C1), (A2, B2, C2), ..., (AN, BN, CN).


    collapse all

    Open a model and get two parameters from the model. Create a gridded parameter space with equal numbers of allowed values for two parameters.

    mdl = 'sdoCSTR';
    pg = sdo.getParameterFromModel(mdl,{'A','h'});
    Avals = {0.2 0.6 1.0 1.4};
    hvals = {0.5 1.5 2.5 3.5};
    gs = sdo.GriddedSpace(pg,{Avals,hvals});

    By default, the sampling method of gs is exhaustive. To generate sequential samples of this space without changing the default sampling method of the space, you can use sdo.GriddingOptions.

    options = sdo.GriddingOptions;
    options.Method = 'sequential';

    When you call sdo.sample using options, it overrides the method specified in gs.Options.Method. Set NumSamples to any positive integer. sdo.sample ignores NumSamples when sampling gridded parameter spaces.

    values = sdo.sample(gs,1,options);

    Version History

    Introduced in R2023a