Main Content

setDistribution

Class: sdo.ParameterSpace
Package: sdo

Set distribution of parameter in sdo.ParameterSpace object

Syntax

ps = setDistribution(ps0,p,pdist)

Description

ps = setDistribution(ps0,p,pdist) updates the ParameterDistributions property of the sdo.ParameterSpace object, ps0, for the specified parameters, p, and returns the updated object, ps.

Input Arguments

ps0

Parameter space, specified as an sdo.ParameterSpace object.

p

Parameters whose distributions are to be updated, specified as one of the following:

  • Vector of param.Continuous objects — Parameter objects. For example, p = sdo.getParameterFromModel('sdoHydraulicCylinder','Ac').

  • Parameter name, specified as a character vector or string. For example, 'Ac'.

pdist

Probability distribution for 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 for the Ac and K parameters of sdoHydraulicCylinder model.

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

By default, a uniform distribution is specified for all parameters in p.

ps.ParameterDistributions
ans=1×2 object
  1x2 UniformDistribution array

Specify a normal distribution for Ac and K.

pAcdist = makedist('Normal','mu',p(1).Value,'sigma',1);
pKdist = makedist('Normal','mu',p(2).Value,'sigma',3);
ps = setDistribution(ps,p,[pAcdist;pKdist]);