Main Content

augoffset

Map offset contribution to extra input channel

Since R2024a

    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:

    x˙=δ0+A(xx0)+B(uu0)y=y0+C(xx0)+D(uu0),

    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.

    Y(s)=H(s)U(s)+h(s)1s=[H(s)h(s)][U(s)1s]

    Here,

    H(s)=D+C(sIA)1Bh(s)=y0+C(sIA)1(δ0Ax0Bu0)

    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 sin(t). 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

    See Also

    |