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 string expressions. For multiple-output models, regressors is 1-by-ny cell array of customreg objects or 1-by-ny cell array of cell arrays of string expressions. 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

Add regressors to a nonlinear ARX model as a cell array of strings:

% Create nonlinear ARX model with standard regressors:
  m1 = idnlarx([4 2 1],'wavenet','nlr',[1:3]);
% Create model with additional custom regressors:
  m2 = addreg(m1,{'y1(t-2)^2';'u1(t)*y1(t-7)'})
% List all standard and custom regressors of m2:
  getreg(m2)

Add regressors to a nonlinear ARX model as customreg objects:

% Create nonlinear ARX model with standard regressors:
  m1 = idnlarx([4 2 1],'wavenet','nlr',[1:3]);
% Create a model based on m1 with custom regressors:
  r1 = customreg(@(x)x^2, {'y1'}, 2)
  r2 = customreg(@(x,y)x*y, {'u1','y1'}, [0 7])
  m2 = addreg(m1,[r1 r2]);

See Also

| | |

Was this topic helpful?