# setcov

Set parameter covariance data in identified model

## Syntax

sys = setcov(sys0,cov)

## Description

sys = setcov(sys0,cov) sets the parameter covariance of identified model sys0 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.

## Input Arguments

 sys0 Identified model. Identified model, specified as an idtf, idss, idgrey, idpoly, idproc, or idnlgrey model. You cannot set the covariance for nonlinear black-box models (idnlarx and idnlhw). cov Parameter covariance matrix. cov is one of the following: an np-by-np semi-positive definite symmetric matrix, where np is equal to the number of parameters of sys0.a 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. Here np is equal to the number of parameters of sys0.cov(Free,Free) = T*inv(R'*R)*T'.

## Output Arguments

 sys Identified model. The values of all the properties of sys are the same as those in sys0, except for the parameter covariance values which are modified as specified by cov.

## Examples

collapse all

Create a transfer function model for the following system:

$sys0=\frac{4}{{s}^{2}+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);

## Version History

Introduced in R2012a