Main Content

addParameter

Class: sdo.ParameterSpace
Package: sdo

Add parameter to sdo.ParameterSpace object

Syntax

ps = addParameter(ps0,p)
ps = addParameter(ps0,p,pdist)

Description

ps = addParameter(ps0,p) adds a model parameter, p, to an sdo.ParameterSpace object, ps0, and returns the updated object, ps. The software updates the ParameterNames property to include the parameter name.

The software also updates the ParameterDistributions property to specify the uniform distribution for the parameter. The software sets the values of the two parameters of the uniform distribution:

  • Lower — Set to p.Minimum. If p.Minimum is equal to -Inf, then the software sets Lower to 0.9*p.Value. Unless p.Value is equal to 0, in which case the software sets Lower to -1.

  • Upper — Set to p.Maximum. If p.Maximum is equal to Inf, then the software sets Upper to 1.1*p.Value. Unless p.Value is equal to 0, in which case the software sets Upper to 1.

ps = addParameter(ps0,p,pdist) specifies the probability distribution of p.

Input Arguments

ps0

Parameter space, specified as an sdo.ParameterSpace object.

p

Model parameters and states, specified as a vector of param.Continuous objects.

For example, sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','K'}).

pdist

Probability distribution of model parameters, specified as a vector of univariate probability distribution objects.

  • If pdist is the same size as p, the software specifies each entry of pdist as the probability distribution of the corresponding parameter in p.

  • If pdist contains only one distribution, the software specifies this object as the probability distribution for all the parameters in p.

Use the makedist command to create a univariate probability distribution object. For example, makedist('Normal','mu',10,'sigma',3).

To check if pdist is a univariate distribution object, run isa('pdist,'prob.UnivariateDistribution').

Output Arguments

ps

Updated parameter space, returned as an sdo.ParameterSpace object.

Examples

expand all

Create an sdo.ParameterSpace object, ps, for the Ac parameter of sdoHydraulicCylinder model.

load_system('sdoHydraulicCylinder');
pAc = sdo.getParameterFromModel('sdoHydraulicCylinder','Ac');
ps = sdo.ParameterSpace(pAc);

Add the K parameter to ps.

pK = sdo.getParameterFromModel('sdoHydraulicCylinder','K');
ps = addParameter(ps,pK);

Create an sdo.ParameterSpace object for the Ac and C1 parameters of the sdoHydraulicCylinder model.

load_system('sdoHydraulicCylinder');
p = sdo.getParameterFromModel('sdoHydraulicCylinder',{'Ac','C1'});
ps = sdo.ParameterSpace(p);

Add the K parameter to ps. Specify a normal distribution for K.

pK = sdo.getParameterFromModel('sdoHydraulicCylinder','K');
pKdist = makedist('Normal','mu',pK.Value,'sigma',2);
ps = addParameter(ps,pK,pKdist);