Main Content

removeParameter

Remove parameter from sdo.ParameterSpace or sdo.GriddedSpace object

    Description

    ps = removeParameter(ps0,p) removes the parameters specified in p from an sdo.ParameterSpace or sdo.GriddedSpace parameter space and returns the updated parameter space.

    example

    Examples

    collapse all

    Create an sdo.ParameterSpace object, ps, for the Ac and K parameters of the sdoHydraulicCylinder model.

    load_system('sdoHydraulicCylinder');
    p  = sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','K'});
    ps = sdo.ParameterSpace(p)
    ps = 
      ParameterSpace with properties:
    
        ParameterDistributions: [1x2 prob.UniformDistribution]
               RankCorrelation: []
                         Notes: []
                ParameterNames: {'Ac'  'K'}
                       Options: [1x1 sdo.SampleOptions]
    
    

    Remove K from ps.

    ps = removeParameter(ps,p(2))
    ps = 
      ParameterSpace with properties:
    
        ParameterDistributions: [1x1 prob.UniformDistribution]
               RankCorrelation: []
                         Notes: []
                ParameterNames: {'Ac'}
                       Options: [1x1 sdo.SampleOptions]
    
    

    Remove Ac from ps using the parameter name.

    ps = removeParameter(ps,'Ac');

    Open the sdoCSTR model and extract continuous parameters A, h, FeedCon0, and FeedTemp0. Assign values to these parameters for gridded sampling and define the parameter space.

    mdl = "sdoCSTR";
    open_system(mdl);
    p = sdo.getParameterFromModel(mdl,{'A','h','FeedCon0','FeedTemp0'});
    Avals = {0.2 0.6 1.0 1.4 1.8 2.2};
    hvals = {0.5 1.5 2.5 3.5};
    Convals = {9.5 10.0 10.5};
    Tempvals = {250,275,300};
    ps0 = sdo.GriddedSpace(p,{Avals,hvals,Convals,Tempvals});

    Suppose that you decide not to sample A and h as part of this parameter space. Remove these parameters by providing their names to removeParameters.

    ps = removeParameter(ps0,{'A','h'})
    ps = 
      GriddedSpace with properties:
    
        ParameterValues: {{1x2 cell}  {1x2 cell}}
                  Notes: []
                 Spaces: {1x0 cell}
         ParameterNames: {'FeedCon0'  'FeedTemp0'}
                Options: [1x1 sdo.GriddingOptions]
    
    

    removeParameter updates ParameterValues and ParameterNames to reflect the reduced set of parameters in the space.

    Input Arguments

    collapse all

    Parameter space to remove parameters from, specified as an sdo.ParameterSpace or sdo.GriddedSpace object.

    Parameters to remove from ps0, specified as one of the following:

    • Character vector, cell array of character vectors, or string containing the names of the parameters to remove from ps0. For example, 'A1', {'A1','A2'}, or "A1".

    • param.Continuous object, param.Discrete object, or vector of parameter objects. Usually, you obtain these objects using sdo.getParameterFromModel or sdo.getStateFromModel.

    Output Arguments

    collapse all

    Updated parameter space, returned as an sdo.ParameterSpace or sdo.GriddedSpace object. removeParameter removes the parameter or parameters specified in p, setting ps.ParameterNames to reflect the removal. The function also sets ps.ParameterDistributions (for randomly sampled parameter spaces) or ps.ParameterValues (for gridded parameter spaces) to reflect the removed parameters.

    Version History

    Introduced in R2014a