## Breach doc: Parameter Sets

Parameter sets in Breach are structures assigning values plus optional uncertainty to symbolic parameters. A parameter set P can be used as a set of initial states for the computation of trajectories. When this is the case, the computed trajectories are stored in an additional field traj, and another field Xf store their end points.

## Creating new parameter sets

To create a new parameter set, use the function CreateParamSet. It takes (at most) three arguments:

• a system Sys, created with the function CreateSystem (see Breach systems)
• a set of uncertain parameters (for the field dim). If none is given, all parameters are considered as uncertain. These parameters can be specified by their index (e.g. : [1 2 4 5]) or by their name (e.g. {'x0','x1','a', 'b'})
• a set of interval ranges for the varying parameters. If none is given, it creates a parameter set with the nominal values in Sys.p and a range of +/- 1 by default.

Here are some examples calling the CreateSampling function for the Lorenz system:

```P0 = CreateParamSet(Sys); % all parameters varying
P1 = CreateParamSet(Sys,[1 2 4]); % varying parameter x0,x1 and a
P2 = CreateParamSet(Sys, {'x0', 'a'}, [-1 1; 0 2]) % varying x0 between -1 and 1 and a between 0 and 2
```

Here we explain how to create a parameter set using the GUI.

## Sampling or Refining parameter sets

Sampling or refining a parameter set is the process of generating new parameter values inside an initial range of values. There are basically two methods: grid and (quasi) random sampling.

### Grid sampling

The routine dedicated to grid sampling is called Refine. It takes two arguments:

• P0 : a parameter set
• delta : a scalar or a vector of dimension size(P0.dim). If it is a scalar, it is interpreted as a vector with all components equal to its value. Its value(s) can be either integer or real.
• If it is integer, the result is a uniform grid centered on the initial range with delta(i) points in dimension i. (see example below where delta=[10 10 5])
• If it is a real then delta is interpreted as a distance and the result is a grid where points are at distance at least delta(i) in dimension i.

This function is better understood through examples. First, create some parameter set with 2 dimensions ranging from -1 to 1:

```P0 = CreateSampling(Sys, {'x0','x1'}, [-1 1; -1 1]);
```

Then :

```Pr1 = Refine(P0, 2) creates a 2x2 grid in [-1 1 -1 1]
Pr2 = Refine(P0, [2 3] creates a 2x3 grid
Pr3 = Refine(P0, .1) creates a grid with resolution (.1,.1)
Pr4 = Refine(P0 [.1 .2]) creates a grid with resolution (.1,.2)
Refine(P0 [1.1 1.2]) returns P0
```

### Quasi-random sampling

When the number of uncertain parameters (size of P.dim) is large, grid sampling becomes impractical since it generates a number of new parameter values which is exponential in the dimensionality of the uncertain set. In this situation, Breach proposes a method to sample uniformly using quasi-random numbers. Quasi-random numbers provides more uniform repartition of a given number of points inside a cube than pseudo-random numbers. Breach makes use of the Halton sequence, hence the name of the routine : HaltonRefine. It is simpler to use than Refine since it refines an initial parameter set into a fix number of parameter values independent from the dimensionality of the uncertain set.

```Prh = HaltonRefine(P0, 100) % generates 100 points uniformly distributed
% in the unit square represented by P0.
```

To be completed.

## Plotting parameter sets

Two functions can be used to plot parameter sets : SplotPts and SplotBoxPts. The first one is the most used and plots only the parameters values. It takes (at most) four arguments, only the first one is mandatory :

• P: a parameter sets
• proj: chooses the parameters to plot; can be numbers or parameters names; all if proj=[]
• ipts: indices of the pts to plot; all if absent or if ipts=[]
• opt: plot options

The second one plots also the uncertain boxes around the points. SplotBoxPts can take two additional arguments:

• col specifies the color of the boxes
• alph transparency of the box plotted

## Examples creating and plotting parameter sets

```P0 =  CreateSampling(Sys, {'x0','x1', 'a'}, [-1 1 ; -2 2; 1 5]);
SplotBoxPts(P0);
```
```Pr = Refine(P0,[10 10 5])
SplotPts(Pts, {'x0', 'a'},[], {'rx', 'MarkerSize',10});
```
```Pr = Refine(P0, 3);
SplotBoxPts(Pr)
```
```Pr = HaltonRefine(P0, 1000);
SplotBoxPts(P0); SplotPts(Pr)
```