Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addreg

Add custom regressors to nonlinear ARX model

Syntax

m = addreg(model,regressors)
m = addreg(model,regressors,output)

Description

m = addreg(model,regressors) adds custom regressors to a nonlinear ARX model by appending the CustomRegressors model property. model and m are idnalrx objects. For single-output models, regressors is an object array of regressors you create using customreg or polyreg, or a cell array of character vectors. For multiple-output models, regressors is 1-by-ny cell array of customreg objects or 1-by-ny cell array of cell arrays of character vectors. addreg adds each element of the ny cells to the corresponding model output channel. If regressors is a single regressor, addreg adds this regressor to all output channels.

m = addreg(model,regressors,output) adds regressors regressors to specific output channels output of a multiple-output model. output is a scalar integer or vector of integers, where each integer is the index of a model output channel. Specify several pairs of regressors and output values to add different regressor variables to the corresponding output channels.

Examples

collapse all

Create nonlinear ARX model with standard regressors.

  m1 = idnlarx([4 2 1],'wavenet','nlr',[1:3]);

Create model with additional custom regressors, specifed as a cell array of character vectors.

  m2 = addreg(m1,{'y1(t-2)^2';'u1(t)*y1(t-7)'});

List all standard and custom regressors of m2.

  getreg(m2)
Regressors:
    y1(t-1)
    y1(t-2)
    y1(t-3)
    y1(t-4)
    u1(t-1)
    u1(t-2)
    y1(t-2)^2
    u1(t)*y1(t-7)

Create nonlinear ARX model with standard regressors.

m1 = idnlarx([4 2 1],'wavenet','nlr',[1:3]);

Create customreg objects.

r1 = customreg(@(x)x^2,{'y1'},2)
Custom Regressor: 
Expression: y1(t-2)^2
        Function: @(x)x^2
       Arguments: {'y1'}
          Delays: 2
      Vectorized: 0
    TimeVariable: 't'

r2 = customreg(@(x,y)x*y,{'u1','y1'},[0 7])
Custom Regressor: 
Expression: u1(t)*y1(t-7)
        Function: @(x,y)x*y
       Arguments: {'u1'  'y1'}
          Delays: [0 7]
      Vectorized: 0
    TimeVariable: 't'

Create a model based on m1 with custom regressors.

m2 = addreg(m1,[r1 r2]);

List all standard and custom regressors of m2.

getreg(m2)
Regressors:
    y1(t-1)
    y1(t-2)
    y1(t-3)
    y1(t-4)
    u1(t-1)
    u1(t-2)
    y1(t-2)^2
    u1(t)*y1(t-7)

See Also

| | |

Introduced in R2007a

Was this topic helpful?