setpar

Set attributes such as values and bounds of linear model parameters

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

collapse all

Estimate an ARMAX model.

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').

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.

Estimate an ARMAX model.

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. Each row represents the bounds for a single parameter. The first value in each row specifies the minimum bound and the second value specifies the maximum bound.

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

Estimate an ARMAX model.

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');

View the default labels.

getpar(sys,'label')
ans = 5x1 cell
{'A1(1)'}
{'B0(1)'}
{'B0(2)'}
{'B0(3)'}
{'C1'   }

Input Arguments

collapse all

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

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

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

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.

Parameter labels, specified as a cell array of character vectors. The cell array is of length nparams(sys). For example, {'a1','a3'}, if nparams(sys) is two.

Use 'default' to assign default labels, A1, A2..., B1,B2,..., to the parameters.

Output Arguments

collapse all

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. 