getreg

Regressor expressions and numerical values in nonlinear ARX model

Syntax

Rs = getreg(model)
Rs = getreg(model,subset)
Rm = getreg(model,subset,data)
Rm = getreg(model,subset,data,init)

Description

Rs = getreg(model) returns expressions for computing regressors in the nonlinear ARX model. model is an idnlarx object.

Rs = getreg(model,subset) returns regressor expressions for a specified subset of regressors.

Rm = getreg(model,subset,data) returns regressor values as a matrix for a specified subset of regressors.

Rm = getreg(model,subset,data,init) returns regressor values as matrices for a specified subset of regressors. The first N rows of each regressor matrix depend on the initial states init, where N is the maximum delay in the regressors (see getDelayInfo). For multiple-output models, Rm is a cell array of cell arrays.

Input Arguments

data

iddata object containing measured data.

init

Initial conditions of your data:

  • 'z' (default) specifies zero initial state.

  • Real column vector containing the initial state values. input and output data values at a time instant before the first sample in data. To create the initial state vector from the input-output data, use the data2state command. For multiple-experiment data, this is a matrix where each column specifies the initial state of the model corresponding to that experiment.

  • iddata object containing input and output samples at time instants before to the first sample in data. When the iddata object contains more samples than the maximum delay in the model, only the most recent samples are used. The minimum number of samples required is equal to max(getDelayInfo(model)).

model

iddata object representing nonlinear ARX model.

subset

Subset of all regressors, specified as one of the following values:

  • (Default) 'all' — All regressors.

  • 'custom'—Only custom regressors.

  • 'input'—Only standard regressors computed from input data.

  • 'linear'—Only regressors not used in the nonlinear block.

  • 'nonlinear'—Only regressors used in the nonlinear block.

    Note

    You can use 'nl' as an abbreviation of 'nonlinear'.

  • 'output'—Only regressors computed from output data.

  • 'standard'—Only standard regressors (excluding any custom regressors).

Output Arguments

Rm

Matrix of regressor values for all or a specified subset of regressors. Each matrix in Rm contains as many rows as there are data samples. For a model with ny outputs, Rm is an ny-by-1 cell array of matrices. When data contains multiple experiments, Rm is a cell array where each element corresponds to a matrix of regressor values for an experiment.

Rs

Regressor expressions represented as a cell array of character vectors. For a model with ny outputs, Rs is an ny-by-1 cell array of cell array of character vectors. For example, the expression 'u1(t-2)' computes the regressor by delaying the input signal u1 by two time samples. Similarly, the expression 'y2(t-1)' computes the regressor by delaying the output signal y2 by one time sample.

The order of regressors in Rs corresponds to regressor indices in the idnlarx object property model.NonlinearRegressors.

Examples

collapse all

Load sample data u and y.

  load twotankdata;
  Ts = 0.2;

Sample time is 0.2 min

Create data object and use first 1000 samples for estimation.

  z = iddata(y,u,Ts);
  ze = z(1:1000);

Estimate nonlinear ARX model.

  model = nlarx(ze,[3 2 1]);

Get regressor expressions.

  Rs = getreg(model);

Get regressor values.

  Rm = getreg(model,'all',ze);

Evaluate model output for one-step-prediction.

  Y = evaluate(model.Nonlinearity,Rm);

The previous result is equivalent to.

  Y_p = predict(model,ze,1,'z');
Introduced in R2007a