Accelerating the pace of engineering and science

# translatecov

Translate parameter covariance across model operations

## Syntax

sys_new = translatecov(fcn,sys)
sys_new = translatecov(fcn,sys1,sys2,...sysn)

## Description

sys_new = translatecov(fcn,sys) translates parameter covariance in the model sys during the transformation operation specified in fcn. Parameter covariance is computed by applying Gauss Approximation formula on the parameter covariance of sys.

sys_new = translatecov(fcn,sys1,sys2,...sysn) translates parameter covariance in the multiple models sys1,sys2,...sysn. The parameters of the systems are assumed to be uncorrelated.

## Input Arguments

 fcn Function for a model transformation operation, specified as a function handle. The function handle describes the transformation such that: For single-model operations, sys_new = fcn(sys). Examples of single-model operations are model-type conversion (idpoly, idss, ...) and sample time conversion (c2d, ...). For example, fcn = @(x)c2d(x,Ts), or fcn = @idpoly.For multi-model operations, sys_new = fcn(sys1,sys2,..). Examples of multimodel operations are merging and concatenation. For example, fcn = @(x,y)[x,y] such that fcn(sys1,sys2) performs horizontal concatenation of the models sys1 and sys2. sys Linear model, specified as one of the following model types: The model must contain parameter covariance information (getcov(sys) is nonempty). sys1,sys2,...sysn Multiple linear models. Models must be of the same type.

## Output Arguments

 sys_new Model resulting from a transformation operation and includes parameter covariance.

## Examples

expand all

### Translate Parameter Covariance During Model Conversion

Convert an estimated transfer function model into state-space model while also translating the estimated parameter covariance.

Estimate a transfer function model.

```load iddata1
sys1 = tfest(z1,2);
```

Convert the estimated model to state-space form while also translating the estimated parameter covariance.

```sys2 = translatecov(@(x)idss(x),sys1);
```

If you convert the transfer function model to state-space form directly, the estimated parameter covariance is lost (the output of getcov is empty).

```sys3 = idss(sys1);
getcov(sys3)
```
```ans =

[]

```

View the parameter covariance in the estimated and converted models.

```covsys1 = getcov(sys1);
covsys2 = getcov(sys2);
```

Compare the confidence regions.

```h = bodeplot(sys1,sys2);
showConfidence(h,2);
```

The confidence bounds for sys1 overlaps with sys2.

### Translate Parameter Covariance During Model Concatenation

Concatenate 3 single-output models such that the covariance data from the 3 models combine to produce the covariance data for the resulting model.

Construct a state-space model.

```a = [-1.1008 0.3733;0.3733 -0.9561];
b = [0.7254 0.7147;-0.0631 -0.2050];
c = [-0.1241 0; 1.4897 0.6715; 1.4090 -1.2075];
d = [0 1.0347; 1.6302 0; 0.4889 0];
sys = idss(a,b,c,d,'Ts',0);
```

Generate multi-output estimation data.

```t = (0:0.01:0.99)';
u = randn(100,2);
y = lsim(sys,u,t,'zoh');
y = y +  rand(size(y))/10;
data = iddata(y,u,0.01);
```

Estimate a separate model for each output signal.

```m1 = ssest(data(:,1,:),2,'feedthrough',true(1,2), 'DisturbanceModel', 'none');
m2 = ssest(data(:,2,:),2,'feedthrough',true(1,2), 'DisturbanceModel', 'none');
m3 = ssest(data(:,3,:),2,'feedthrough',true(1,2), 'DisturbanceModel', 'none');
```

Combine the estimated models while also translating the covariance information.

```f = @(x,y,z)[x;y;z];
M2 = translatecov(f, m1, m2, m3);
```

The parameter covariance is not empty.

```getcov(M2, 'factors')
```
```ans =

R: [36x36 double]
T: [24x36 double]
Free: [90x1 logical]

```

If you combine the estimated models into one 3-output model directly, the covariance information is lost (the output of getcov is empty).

```M1 = [m1;m2;m3];
getcov(M1)
```
```ans =

[]

```

Compare the confidence bounds.

```h = bodeplot(M2, m1, m2, m3);
showConfidence(h);
```

The confidence bounds for M2 overlap with those of m1, m2 and m3 models on their respective plot axes.

expand all

### Tips

• translatecov transforms the model in the same way that directly calling the transformation command does. For example, translatecov(@(x)d2c(x),sys) produces a system that has the same coefficients as d2c(sys). The resulting model also has the parameter covariance of sys. Using d2c(sys) directly does not translate the parameter covariance.

• If you obtained sys through estimation and have access to the estimation data, you can use zero-iteration update to recompute the parameter covariance. For example:

```load iddata1
m = ssest(z1,4);
opt = ssestOptions
opt.SearchOption.MaxIter = 0;
m_new = ssest(z1,m2,opt)
```

You cannot run a zero-iteration update in the following cases:

• If MaxIter option, which depends on the SearchMethod option, is not available.

• For some model and data types. For example, a continuous-time idpoly model using time-domain data.

### Algorithms

translatecov uses numerical perturbations of individual parameters of sys to compute the Jacobian of fcn(sys) parameters with respect to parameters of sys. translatecov then applies Gauss Approximation formula to translate the covariance, where J is the Jacobian matrix. This operation can be slow for models containing a large number of free parameters.