# augoffset

Map offset contribution to extra input channel

Since R2024a

## Syntax

``asys = augoffset(sys)``

## Description

For a state-space model with offsets, `augoffset` returns an offset-free state-space model with one extra input channel.

The function constructs a model such that the response of the original model to an input u(t) matches the response of the augmented model to [u(t) ; 1]. That is, the response of the augmented model is the same as the original model when you apply a unit step to the extra input channel and an input u(t) to the remaining input channels.

For a state-space model with offsets given by:

`$\begin{array}{l}\stackrel{˙}{x}={\delta }_{0}+A\left(x-{x}_{0}\right)+B\left(u-{u}_{0}\right)\\ y={y}_{0}+C\left(x-{x}_{0}\right)+D\left(u-{u}_{0}\right),\end{array}$`

the transfer function of the augmented model is [H(s) h(s)], where H(s) and h(s) are the linear and affine parts of the original model, respectively. Therefore, the frequency response is the frequency-domain expression of the time-domain connection.

`$\begin{array}{c}Y\left(s\right)=H\left(s\right)U\left(s\right)+h\left(s\right)\frac{1}{s}\\ =\left[\begin{array}{cc}H\left(s\right)& h\left(s\right)\end{array}\right]\left[\begin{array}{c}U\left(s\right)\\ \frac{1}{s}\end{array}\right]\end{array}$`

Here,

`$\begin{array}{l}H\left(s\right)=D+C{\left(}^{s}B\\ h\left(s\right)={y}_{0}+C{\left(}^{s}\left({\delta }_{0}-A{x}_{0}-B{u}_{0}\right)\end{array}$`

Note that H(s) is the usual transfer function without offsets.

You can use `augoffset` to turn offsets into an additional input and visualize the corresponding frequency response.

example

````asys = augoffset(sys)` takes a state-space model `sys` with offsets and returns an offset-free state-space model with one extra input channel.```

## Examples

collapse all

This example shows how to obtain an offset-free state-space from a model with offsets using the `augoffset` function. The `augoffset` function constructs a model with an extra input channel and maps the contribution of the offsets in the original model to that extra input channel.

For this example, consider a linear time-varying model defined by the data function `ltvssDataFcn.m`.

Create an LTV model.

`ltvSys = ltvss(@ltvssDataFcn)`
```Continuous-time state-space LTV model with 1 outputs, 1 inputs, and 1 states. ```

Sample the LTV dynamics at 5 seconds to obtain the local LTI model.

```t = 5; sys = psample(ltvSys,t);```

The model `sys` contains an output offset.

`sys.Offsets`
```ans = struct with fields: dx: 0 x: 0 u: 0 y: -0.0132 ```

Use `augoffset` to eliminate the offset.

`asys = augoffset(sys);`

Compare the model response to an input $\mathrm{sin}\left(\mathit{t}\right)$. The response of the augmented model is the same as the original model when you apply a unit step to the extra input channel.

```tsim = 0:0.01:5; usim = sin(tsim); [y1,~,x1] = lsim(sys,usim,tsim); [y2,~,x2] = lsim(asys,[usim;ones(size(tsim))],tsim); plot(tsim,y1,tsim,y2,'r--') legend("Original model with offsets","Offset-free model")```

View the data function code.

`type ltvssDataFcn.m`
```function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = ltvssDataFcn(t) % SISO, first order A = -(1+0.5*sin(t)); B = 1; C = 1; D = 0; E = []; dx0 = []; x0 = []; u0 = []; y0 = 0.1*sin(5*t); Delays = []; ```

## Input Arguments

collapse all

State-space model with offsets, specified as an `ss` or `sparss` model object.

## Output Arguments

collapse all

Augmented state-space model, returned as the model of same type as `sys`.

## Version History

Introduced in R2024a