Main Content

setpvec

Modify values of model parameters

Syntax

sys = setpvec(sys0,par)
sys = setpvec(sys0,par,'free')

Description

sys = setpvec(sys0,par) modifies the value of the parameters of the identified model sys0 to the value specified by par.

par must be of length nparams(sys0). nparams(sys0) returns a count of all the parameters of sys0.

sys = setpvec(sys0,par,'free') modifies the value of all the free estimation parameters of sys0 to the value specified by par.

par must be of length nparams(sys0,'free'). nparams(sys0,'free') returns a count of all the free parameters of sys0. For idnlarx and idnlhw models, all parameters are treated as free.

Input Arguments

sys0

Identified model, specified as an idtf, idss, idgrey, idpoly, idproc, idnlarx, idnlhw, or idnlgrey object.

par

Replacement value for the parameters of the identified model sys0.

For the syntax sys = setpvec(sys0,par), par must be of length nparams(sys0). nparams(sys0) returns a count of all the parameters of sys0.

For the syntax sys = setpvec(sys0,par,'free'), par must be of length nparams(sys0,'free'). nparams(sys0,'free') returns a count of all the free parameters of sys0.

Use NaN to denote unknown parameter values.

If sys0 is an array of models, then specify par as a cell array with an entry corresponding to each model in sys0.

Output Arguments

sys

Identified model obtained from sys0 by updating the values of the specified parameters.

Examples

collapse all

Construct a transfer function model.

sys0 = idtf(1,[1 2]);

Define a parameter vector and use it to set the model parameters. The second parameter is set to NaN, indicating that its value is unknown.

par = [1;NaN;0];
sys = setpvec(sys0,par);

The constructed model, sys, can be used to initialize a model estimation.

Construct a transfer function model.

sys0 = idtf([1 0],[1 2 0]);

Set the first three parameters of sys0 as free parameters.

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

Define a parameter vector and use it to set the free model parameters.

par = [1;2;1];
sys = setpvec(sys0,par,'free');

Version History

Introduced in R2012a

See Also

| |