Main Content

getpar

Obtain attributes such as values and bounds of linear model parameters

Description

value = getpar(sys,'value') returns the parameter values of the model sys. If sys is a model array, the returned value is a cell array of size equal to the model array.

example

free = getpar(sys,'free') returns the free or fixed status of the parameters.

example

bounds = getpar(sys,'bounds') returns the minimum and maximum bounds on the parameters.

example

label = getpar(sys,'label') returns the labels for the parameters.

example

getpar(sys) prints a table of parameter values, labels, free status and minimum and maximum bounds.

example

Examples

collapse all

Get the parameter values of an estimated 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]);

Get the parameter values.

val = getpar(sys,'value')
val = 5×1

   -0.7519
   -0.4341
    0.4442
    0.0119
    0.3431

To set parameter values, use sys = setpar(sys,'value',value).

Get the free parameters and their bounds for a process model.

Construct a process model, and set its parameter values and free status.

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

Here, the value of Td is fixed.

Get the parameter values.

Val = getpar(m,'Value')
Val = 5×1

    1.0000
  100.0000
    0.3000
    0.4000
   10.0000

Get the free statuses of the parameters.

Free = getpar(m,'Free')
Free = 5x1 logical array

   1
   1
   1
   0
   1

The output indicates that Td is a fixed parameter and the remaining parameters are free.

Get the default bounds on the parameters.

MinMax = getpar(m,'bounds')
MinMax = 5×2

  -Inf   Inf
     0   Inf
     0   Inf
     0   Inf
  -Inf   Inf

Extract the values of the free parameters.

FreeValues = Val(Free)
FreeValues = 4×1

    1.0000
  100.0000
    0.3000
   10.0000

Extract the bounds on the free parameters.

FreeValBounds = MinMax(Free,:)
FreeValBounds = 4×2

  -Inf   Inf
     0   Inf
     0   Inf
  -Inf   Inf

Get the parameter labels of an estimated 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 parameter labels.

sys.Structure.A.Info(2).Label = 'a2';

Get the parameter labels.

label = getpar(sys,'label')
label = 5x1 cell
    {'a2'    }
    {0x0 char}
    {0x0 char}
    {0x0 char}
    {0x0 char}

Obtain a table of all model parameter attributes of an ARMAX model.

Estimate an ARMAX model.

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

Get all parameter attributes.

getpar(sys)
------------------------------------------------------
  #  Label     Value   Free       Min.         Max.   
------------------------------------------------------
  1.         -1.4328    1       -Inf          Inf
  2.           0.497    1       -Inf          Inf
  3.         0.22904    1       -Inf          Inf
  4.        -0.09849    1       -Inf          Inf
  5.        -0.10246    1       -Inf          Inf
  6.          1.1671    1       -Inf          Inf
  7.         0.39579    1       -Inf          Inf
  8.         0.97219    1       -Inf          Inf
  9.        0.026995    1       -Inf          Inf
 10.        -0.17113    1       -Inf          Inf
 11.         0.16155    1       -Inf          Inf
 12.         0.48468    1       -Inf          Inf
 13.         -1.8871    1       -Inf          Inf
 14.         0.97391    1       -Inf          Inf

Input Arguments

collapse all

Identified linear model, specified as an idss, idpoly, idgrey, idtf, or idfrd model object or an array of model objects.

Output Arguments

collapse all

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

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

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

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

Version History

Introduced in R2013b