polyreg

Powers and products of standard regressors

Syntax

R = polyreg(model)
R = polyreg(model,'MaxPower',n)
R = polyreg(model,'MaxPower',n,'CrossTerm',CrossTermVal)

Description

R = polyreg(model) creates an array R of polynomial regressors up to the power 2. If a model order has input u and output y, na=nb=2, and delay nk=1, polynomial regressors are y(t−1)2, u(t−1)2, y(t−2)2, u(t−2)2. model is an idnlarx object. You must add these regressors to the model by assigning the CustomRegressors model property or by using addreg.

R = polyreg(model,'MaxPower',n) creates an array R of polynomial regressors up to the power n. Excludes terms of power 1 and cross terms, such as y(t−1)*u(t−1).

R = polyreg(model,'MaxPower',n,'CrossTerm',CrossTermVal) creates an array R of polynomial regressors up to the power n and includes cross terms (products of standards regressors) when CrossTermVal is 'on'. By default, CrossTermVal is 'off'.

Examples

collapse all

Estimate a nonlinear ARX model with na=2, nb=2, and nk=1, and nonlinearity estimator wavenet.

load iddata1
m = nlarx(z1,[2 2 1]);

Create polynomial regressors.

R = polyreg(m);

Estimate the model.

m = nlarx(z1,[2 2 1],'wavenet','CustomReg',R);

View all model regressors (standard and custom).

getreg(m)
Regressors:
    y1(t-1)
    y1(t-2)
    u1(t-1)
    u1(t-2)
    y1(t-1).^2
    y1(t-2).^2
    u1(t-1).^2
    u1(t-2).^2

Estimate a nonlinear ARX model with na=2, nb=1, and nk=1, and nonlinearity estimator wavenet.

load iddata1
m = nlarx(z1,[2 1 1]);

Create polynomial regressors.

R = polyreg(m,'MaxPower',3,'CrossTerm','on')
16x1 array of Custom Regressors with fields: Function, Arguments, Delays, Vectorized

If the model m has three standard regressors a, b and c, then R includes the terms a2, b2, c2, ab, ac, bc, a2b, a2c, ab2, abc, ac2, b2c, bc2, a3, b3, and c3.

Estimate the model.

m = nlarx(z1,[2 1 1],'wavenet','CustomReg',R);

Introduced in R2007a