Accelerating the pace of engineering and science

# setcov

Set parameter covariance data in identified model

## Syntax

sys = setcov(sys0,cov)

## Description

sys = setcov(sys0,cov) modifies the parameter covariance of sys0 to the value specified by 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. 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

expand all

### Raw Covariance

Set raw covariance data for an identified model.

Create a covariance matrix for the transfer function

$sys0=\frac{4}{{s}^{2}+2s+1}$

.

For this example, set the covariance values for only the denominator parameters.

```sys0 = idtf(4,[1 2 1]);
np = nparams(sys0);
cov = zeros(np);
den_index = 2:3;
cov(den_index,den_index)=diag([0.04 0.001]);
```

sys0 contains np model parameters.

cov(den_index,den_index)=diag([0.04 0.001]) creates a covariance matrix, cov, with nonzero entries for the denominator parameters.

Set the covariance for sys0.

`sys = setcov(sys0,cov);`