Main Content

setpvec

Modify values of model parameters

    Description

    example

    newSys = setpvec(sys,params) returns an new identified model of the same type as the identified model sys. The parameters of newSys are set to the values specified in params.

    example

    newSys = setpvec(sys,params,'free') sets the values of only the free parameters in newSys. For idnlarx and idnlhw models, all parameters are treated as free.

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

    Input Arguments

    collapse all

    Identified model, specified as one of the following model objects or an array of such objects.

    Parameter values, specified as a vector.

    When you set the values of all parameters, params must be of length nparams(sys).

    When you set the values of only free parameters, params must be of length nparams(sys,'free').

    If sys is a model array, then specify params as a cell array with an entry corresponding to each model in sys.

    Output Arguments

    collapse all

    Identified model, returned as the same type of identified model object as sys. The parameters in newSys match the new parameter values specified in params.

    Version History

    Introduced in R2012a

    See Also

    | |