Accelerating the pace of engineering and science

# 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

Create polynomial regressors up to order 2:

```% Estimate a nonlinear ARX model with
% na=nb=2 and nk=1.
% Nonlinearity estimator is wavenet.
m = nlarx(z1,[2 2 1])
% Create polynomial regressors:
R = polyreg(m);
% Estimate model:
m = nlarx(z1,[2 2 1],'wavenet','CustomReg',R);
% View all model regressors (standard and custom):
getreg(m)```

Create polynomial regressors up to order 3:

`R = polyreg(m,'MaxPower',3,'CrossTerm','on')`

If the model m that has three standard regressors a, b and c , R includes a^2, b^2, c^2, a*b, a*c, b*c, a^2*b, a^2*c, a*b^2, a*b*c, a*c^2, b^2*c, b*c^2, a^3, b^3, and c^3.