# linear

Class representing linear nonlinearity estimator for nonlinear ARX models

## Syntax

`lin=linearlin=linear('Parameters',Par)`

## Description

`linear` is an object that stores the linear nonlinearity estimator for estimating nonlinear ARX models.

`lin=linear` instantiates the `linear` object.

`lin=linear('Parameters',Par)` instantiates the `linear` object and specifies optional values in the `Par` structure. For more information about this structure, see linear Properties.

## linear Properties

You can include property-value pairs in the constructor to specify the object.

After creating the object, you can use `get` or dot notation to access the object property values. For example:

```% List Parameters values get(lin) % Get value of Parameters property lin.Parameters```
Property NameDescription
`Parameters`

Structure containing the following fields:

• `LinearCoef`: `m`-by-1 vector L.

• `OutputOffset`: Scalar `d`.

## Examples

Estimate a nonlinear ARX model using the `linear` estimator with custom regressors for the following system:

y(t) = a1y(t–1) + a2y(t–2) + a3u(t–1) + a4y(t–1)u(t–2) + a5|u(t)|u(t–3) + a6,

where u is the input and y is the output.

```% Create regressors y(t-1), y(t-2) and u(t-1). orders = [2 1 1]; % Create an idnlarx model using linear estimator with custom regressors. model = idnlarx(orders, linear, 'InputName', 'u', 'OutputName', 'y',... 'CustomRegressors', {'y(t-1)*u(t-2)','abs(u(t))*u(t-3)'}) % Estimate the model parameters a1, a2, ... a6. EstimatedModel = nlarx(data, model) ```
 Note:   The nonlinearity in the model is described by custom regressors only.

collapse all

### Tips

• `linear` is a linear (affine) function $y=F\left(x\right)$, defined as follows:

`$F\left(x\right)=xL+d$`

y is scalar, and x is a 1-by-`m` vector.

• Use `evaluate(lin,x)` to compute the value of the function defined by the `linear` object `lin` at `x`.

• When creating a nonlinear ARX model using the constructor (`idnlarx`) or estimator (`nlarx`), you can specify a linear nonlinearity estimator using `[]`, instead of entering `linear` explicitly. For example:

`m=idnlarx(orders,[]);`

### Algorithms

When the `Focus` option in `nlarxOptions` is `'prediction'`, `linear` uses a fast, noniterative initialization and iterative search technique for estimating parameters. In most cases, iterative search requires only a few iterations.

When the `idnlarx` property `Focus='Simulation'`, `linear` uses an iterative technique for estimating parameters.