Accelerating the pace of engineering and science

• Trials

idParametric/setpar

Set attributes such as values and bounds of linear model parameters

Syntax

• sys1 = setpar(sys,'value',value) example
• sys1 = setpar(sys,'free',free) example
• sys1 = setpar(sys,'bounds',bounds) example
• sys1 = setpar(sys,'label',label) example

Description

example

sys1 = setpar(sys,'value',value) sets the parameter values of the model sys. For model arrays, use setpar separately on each model in the array.

example

sys1 = setpar(sys,'free',free) sets the free or fixed status of the parameters.

example

sys1 = setpar(sys,'bounds',bounds) sets the minimum and maximum bounds on the parameters.

example

sys1 = setpar(sys,'label',label) sets the labels for the parameters.

Examples

expand all

Assign Model Parameter Values

Set model parameter values of an ARMAX model.

Estimate an ARMAX model.

```load iddata8;
init_data = z8(1:100);
na=1;
nb=[1 1 1];
nc=1;
nk=[0 0 0];
sys = armax(init_data,[na nb nc nk]);```

Set the parameter values.

`sys = setpar(sys,'value',[0.5 0.1 0.3 0.02 0.5]');`

To view the values, type val = getpar(sys,'value').

Fix or Free Model Parameters

Specify whether to fix or free a process model parameters for estimation.

Construct a process model.

```m = idproc('P2DUZI');
m.Kp = 1;
m.Tw = 100;
m.Zeta = .3;
m.Tz = 10;
m.Td = 0.4;```

Set the free status of the parameters.

`m=setpar(m,'free',[1 1 1 1 0]);`

Here, you set Tz to be a fixed parameter.

To check the free status of Tz, type m.Structure.Tz.

Set Minimum and Maximum Bounds on Parameters

Specify minimum and maximum bounds on parameters of an ARMAX model.

Estimate an ARMAX model.

```load iddata8;
init_data = z8(1:100);
na=1;
nb=[1 1 1];
nc=1;
nk=[0 0 0];
sys = armax(init_data,[na nb nc nk]);```

Set the minimum and maximum bounds for the parameters.

`sys=setpar(sys,'bounds',[0 1; 1 1.5; 0 2; 0.5 1; 0 1]);`

Assign Default Labels to Parameters

Set the parameter labels to default labels for an ARMAX model.

Estimate an ARMAX model.

```load iddata8;
init_data = z8(1:100);
na=1;
nb=[1 1 1];
nc=1;
nk=[0 0 0];
sys = armax(init_data,[na nb nc nk]);```

Assign default labels to model parameters.

`sys = setpar(sys,'label','default');`

To view the labels, type getpar(sys,'label').

Input Arguments

expand all

sys — Identified linear modelidss | idproc | idgrey | idtf | idpoly

Identified linear model, specified as an idss, idproc, idgrey, idtf, or idpoly model object.

value — Parameter valuesvector of doubles

Parameter values, specified as a double vector of length nparams(sys).

free — Free or fixed status of parametersvector of logical values

Free or fixed status of parameters, specified as a logical vector of length nparams(sys).

bounds — Minimum and maximum bounds on parametersmatrix of doubles

Minimum and maximum bounds on parameters, specified as a double matrix of size nparams(sys)-by-2. The first column specifies the minimum bound and the second column the maximum bound.

label — Parameter labelscell array of strings | 'default'

Parameter labels, specified as a cell array of strings. The cell array is of length nparams(sys).

Use 'default' to assign default labels, a1, a2..., b1,b2,..., to the parameters.

Output Arguments

expand all

sys1 — Model with specified values of parameter attributesidss | idproc | idgrey | idtf | idpoly

Model with specified values of parameter attributes. The model sys you specify as the input to setpar gets updated with the specified parameter attribute values.