Main Content

setcov

Set parameter covariance data in identified model

    Description

    example

    newSys = setcov(sys,cov) sets the parameter covariance of identified model sys as cov.

    The model parameter covariance is calculated and stored automatically when a model is estimated. Therefore, you do not need to set the parameter covariance explicitly for estimated models. Use this function for analysis, such as to study how the parameter covariance affects the response of a model obtained by explicit construction.

    Examples

    collapse all

    Create a transfer function model for the following system:

    sys0=4s2+2s+1

    sys0 = idtf(4,[1 2 1]);
    np = nparams(sys0);

    sys0 contains np model parameters.

    Specify the covariance values for the denominator parameters only.

    cov = zeros(np);
    den_index = 2:3;
    cov(den_index,den_index) = diag([0.04 0.001]);

    cov is a covariance matrix with nonzero entries for the denominator parameters.

    Set the covariance for sys0.

    sys = setcov(sys0,cov);

    Input Arguments

    collapse all

    Identified model, specified as one of the following model objects.

    Parameter covariance matrix, specified as one of the following:

    • Np-by-Np semi-positive definite symmetric matrix, where Np is equal to the number of parameters of sys.

    • Structure with the following fields that describe the parameter covariance in a factored form.

      • R — Usually the Cholesky factor of inverse of covariance

      • T — Transformation matrix

      • Free — Logical vector of length Np indicating if a parameter is free.

      To derive the covariance matrix use the command cov(Free,Free) = T*inv(R'*R)*T'.

    Output Arguments

    collapse all

    Identified model, returned as the same type of identified model object as sys. The parameter covariance matrix in newSys matches the new covariance matrix specified in params.

    Version History

    Introduced in R2012a

    See Also

    | | |