Accelerating the pace of engineering and science

# Documentation

## Subreferencing Models

### What Is Subreferencing?

You can use subreferencing to create models with subsets of inputs and outputs from existing multivariable models. Subreferencing is also useful when you want to generate model plots for only certain channels, such as when you are exploring multiple-output models for input channels that have minimal effect on the output.

The toolbox supports subreferencing operations for idtf, idpoly, idproc, idss, and idfrd model objects.

Subreferencing is not supported for idgrey models. If you want to analyze the sub-model, convert it into an idss model first, and then subreference the I/Os of the idss model. If you want a grey-box representation of a subset of I/Os, create a new idgrey model that uses an ODE function returning the desired I/O dynamics.

In addition to subreferencing the model for specific combinations of measured inputs and output, you can subreference dynamic and noise models individually.

### Limitation on Supported Models

Subreferencing nonlinear models is not supported.

### Subreferencing Specific Measured Channels

Use the following general syntax to subreference specific input and output channels in models:

```model(outputs,inputs)
```

In this syntax, outputs and inputs specify channel indexes or channel names.

To select all output or all input channels, use a colon (:). To select no channels, specify an empty matrix ([]). If you need to reference several channel names, use a cell array of strings.

For example, to create a new model m2 from m from inputs 1 ('power') and 4 ('speed') to output number 3 ('position'), use either of the following equivalent commands:

```m2 = m('position',{'power','speed'})
```

or

```m2 = m(3,[1 4])
```

For a single-output model, you can use the following syntax to subreference specific input channels without ambiguity:

```m3 = m(inputs)
```

Similarly, for a single-input model, you can use the following syntax to subreference specific output channels:

```m4 = m(outputs)
```

### Separation of Measured and Noise Components of Models

For linear models, the general symbolic model description is given by:

$y=Gu+He$

G is an operator that takes the measured inputs u to the outputs and captures the system dynamics.

H is an operator that describes the properties of the additive output disturbance and takes the hypothetical (unmeasured) noise source inputs to the outputs. H represents the noise model. When you specify to estimate a noise model, the resulting model include one noise channel e at the input for each output in your system.

Thus, linear, parametric models represent input-output relationships for two kinds of input channels: measured inputs and (unmeasured) noise inputs. For example, consider the ARX model given by one of the following equations:

$A\left(q\right)y\left(t\right)=B\left(q\right)u\left(t-nk\right)+e\left(t\right)$

or

$y\left(t\right)=\frac{B\left(q\right)}{A\left(q\right)}u\left(t\right)+\frac{1}{A\left(q\right)}e\left(t\right)$

In this case, the dynamic model is the relationship between the measured input u and output y, $G=B\left(q\right)}{A\left(q\right)}$. The noise model is the contribution of the input noise e to the output y, given by$H=1}{A\left(q\right)}$.

Suppose that the model m contains both a dynamic model G and a noise model H. To create a new model that only has G and no noise contribution, simply set its NoiseVariance property value to zero value.

To create a new model by subreferencing H due to unmeasured inputs, use the following syntax:

```m_H = m(:,[])
```

This operation creates a time-series model from m by ignoring the measured input.

The covariance matrix of e is given by the model property NoiseVariance, which is the matrix $\Lambda$:

$\Lambda =L{L}^{T}$

The covariance matrix of e is related to v, as follows:

$e=Lv$

where v is white noise with an identity covariance matrix representing independent noise sources with unit variances.

### Treating Noise Channels as Measured Inputs

To study noise contributions in more detail, it might be useful to convert the noise channels to measured channels using noisecnv:

```m_GH = noisecnv(m)
```

This operation creates a model m_GH that represents both measured inputs u and noise inputs e, treating both sources as measured signals. m_GH is a model from u and e to y, describing the transfer functions G and H.

Converting noise channels to measured inputs loses information about the variance of the innovations e. For example, step response due to the noise channels does not take into consideration the magnitude of the noise contributions. To include this variance information, normalize e such that v becomes white noise with an identity covariance matrix, where

$e=Lv$

To normalize e, use the following command:

```m_GH = noisecnv(m,'Norm')
```

This command creates a model where u and v are treated as measured signals, as follows:

$y\left(t\right)=Gu\left(t\right)+HLv=\left[\begin{array}{cc}G& HL\end{array}\right]\left[\begin{array}{c}u\\ v\end{array}\right]$

For example, the scaling by L causes the step responses from v to y to reflect the size of the disturbance influence.

The converted noise sources are named in a way that relates the noise channel to the corresponding output. Unnormalized noise sources e are assigned names such as 'e@y1', 'e@y2', ..., 'e@yn', where 'e@yn' refers to the noise input associated with the output yn. Similarly, normalized noise sources v, are named 'v@y1', 'v@y2', ..., 'v@yn'.

If you want to create a model that has only the noise channels of an identified model as its measured inputs, use the noise2meas command. It results in a model with y(t) = He or y(t) = HLv, where e or v is treated as a measured input.

 Note:   When you plot models in the app that include noise sources, you can select to view the response of the noise model corresponding to specific outputs. For more information, see Selecting Measured and Noise Channels in Plots.