Estimate parameters of nonlinear ARX model
estimates a nonlinear ARX model using the specified regressor set
sys
= nlarx(data
,regressors
)regressors
. Use this syntax when you have linear
regressors that have nonconsecutive lags, or when you also have polynomial
regressors, custom regressors, or both.
specifies the output function that maps the regressors to the model output. You
can use this syntax with any of the previous input argument combinations.sys
= nlarx(___,output_fcn
)
specifies the output function to use for model estimation.sys
= nlarx(data
,linmodel
,output_fcn
)
estimates or refines the parameters of the nonlinear ARX model
sys
= nlarx(data
,sys0
)sys0
.
Use this syntax to:
Estimate the parameters of a model previously created using the
idnlarx
constructor. Prior to estimation, you
can configure the model properties using dot notation.
Update the parameters of a previously estimated model to improve the
fit to the estimation data. In this case, the estimation algorithm uses
the parameters of sys0
as initial guesses.
Load the estimation data.
load twotankdata;
Create an iddata
object from the estimation data with a sample time of 0.2 seconds.
Ts = 0.2; z = iddata(y,u,Ts);
Estimate the nonlinear ARX model using ARX model orders to specify the regressors.
sysNL = nlarx(z,[4 4 1])
sysNL = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 List of all regressors Output function: Wavelet Network with 11 units Sample time: 0.2 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: 96.84% (prediction focus) FPE: 3.482e05, MSE: 3.431e05
sys
uses the default wavenet
function as the output function.
For comparison, compute a linear ARX model with the same model orders.
sysL = arx(z,[4 4 1]);
Compare the model outputs with the original data.
compare(z,sysNL,sysL)
The nonlinear model has a much better fit to the data than the linear model.
Specify a linear regressor that is equivalent to an ARX model order matrix of [4 4 1]
.
An order matrix of [4 4 1]
specifies that both input and output regressor sets contain four regressors with lags ranging from 1 to 4. For example, ${\mathit{u}}_{1}\left(\mathit{t}2\right)$ represents the second input regressor.
Specify the output and input names.
output_name = 'y1'; input_name = 'u1'; names = {output_name,input_name};
Specify the output and input lags.
output_lag = [1 2 3 4]; input_lag = [1 2 3 4]; lags = {output_lag,input_lag};
Create the linear regressor object.
lreg = linearRegressor(names,lags)
lreg = Linear regressors in variables y1, u1 Variables: {'y1' 'u1'} Lags: {[1 2 3 4] [1 2 3 4]} UseAbsolute: [0 0] TimeVariable: 't' Regressors described by this set
Load the estimation data and create an iddata object.
load twotankdata
z = iddata(y,u,0.2);
Estimate the nonlinear ARX model.
sys = nlarx(z,lreg)
sys = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 List of all regressors Output function: Wavelet Network with 11 units Sample time: 0.2 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: 96.84% (prediction focus) FPE: 3.482e05, MSE: 3.431e05
View the regressors
getreg(sys)
ans = 8×1 cell
{'y1(t1)'}
{'y1(t2)'}
{'y1(t3)'}
{'y1(t4)'}
{'u1(t1)'}
{'u1(t2)'}
{'u1(t3)'}
{'u1(t4)'}
Compare the model output to the estimation data.
compare(z,sys)
Create time and data arrays.
dt = 0.01; t = 0:dt:10; y = 10*sin(2*pi*t)+rand(size(t));
Create an iddata
object with no input signal specified.
z = iddata(y',[],dt);
Estimate the nonlinear ARX model.
sys = nlarx(z,2)
sys = Nonlinear time series model Outputs: y1 Regressors: Linear regressors in variables y1 List of all regressors Output function: Wavelet Network with 8 units Sample time: 0.01 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: 92.92% (prediction focus) FPE: 0.2568, MSE: 0.2507
Estimate a nonlinear ARX model that uses the mapping function sigmoidnet
as its output function.
Load the data and divide it into the estimation and validation data sets ze
and zv
.
load twotankdata.mat u y z = iddata(y,u,'Ts',0.2); ze = z(1:1500); zv = z(1501:end);
Configure the sigmoidnet
mapping function. Fix the offset to 0.2 and the number of units to 15.
s = sigmoidnet; s.Offset.Value = 0.2; s. NonlinearFcn.NumberOfUnits = 15;
Create a linear model regressor specification that contains four output regressors and five input regressors.
reg1 = linearRegressor({'y1','u1'},{1:4,0:4});
Create a polynomial model regressor specification that contains the squares of two input terms and three output terms.
reg2 = polynomialRegressor({'y1','u1'},{1:2,0:2},2);
Set estimation options for the search method and maximum number of iterations.
opt = nlarxOptions('SearchMethod','fmincon')'; opt.SearchOptions.MaxIterations = 40;
Estimate the nonlinear ARX model.
sys = nlarx(ze,[reg1;reg2],s,opt);
Validate sys
by comparing the simulated model response to the validation data set.
compare(zv,sys)
Estimate a linear model and improve the model by adding a treepartition
output function.
Load the estimation data.
load throttledata ThrottleData
Estimate a linear ARX model linsys
with orders [2 2 1]
.
linsys = arx(ThrottleData,[2 2 1]);
Create an idnlarx
template model that uses linsys
and specifies sigmoidnet
as the output function.
sys0 = idnlarx(linsys,treepartition);
Fix the linear component of sys0
so that during estimation, the linear portion of sys0
remains identical to linsys
.
sys0.OutputFcn.LinearFcn.Free = false;
Estimate the free parameters of sys0
, which are the nonlinearfunction parameters and the offset.
sys = nlarx(ThrottleData,sys0);
Compare the fit accuracies for the linear and nonlinear models.
compare(ThrottleData,linsys,sys)
Generating a custom network mapping object requires the definition of a userdefined unit function.
Define the unit function and save it as gaussunit.m
.
% Copyright 2015 The MathWorks, Inc. function [f, g, a] = gaussunit(x) f = exp(x.*x); if nargout>1 g = 2*x.*f; a = 0.2; end
Create a custom network mapping object using a handle to the gaussunit
function.
H = @gaussunit; CNet = customnet(H);
Load the estimation data.
load iddata1;
Estimate a nonlinear ARX model using the custom network.
sys = nlarx(z1,[1 2 1],CNet)
sys = <strong>Nonlinear ARX model with 1 output and 1 input</strong> Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 Output function: Custom Network with 10 units Sample time: 0.1 seconds Status: Estimated using NLARX on time domain data "z1". Fit to estimation data: 64.35% (prediction focus) FPE: 3.58, MSE: 2.465
Load the estimation data.
load motorizedcamera;
Create an iddata
object.
z = iddata(y,u,0.02,'Name','Motorized Camera','TimeUnit','s');
z
is an iddata
object with six inputs and two outputs.
Specify the model orders.
Orders = [ones(2,2),2*ones(2,6),ones(2,6)];
Specify different mapping functions for each output channel.
NL = [wavenet('NumberOfUnits',2),linear];
Estimate the nonlinear ARX model.
sys = nlarx(z,Orders,NL)
sys = Nonlinear ARX model with 2 outputs and 6 inputs Inputs: u1, u2, u3, u4, u5, u6 Outputs: y1, y2 Regressors: Linear regressors in variables y1, y2, u1, u2, u3, u4, u5, u6 List of all regressors Output functions: Output 1: Wavelet Network with 2 units Output 2: Linear Function Sample time: 0.02 seconds Status: Estimated using NLARX on time domain data "Motorized Camera". Fit to estimation data: [98.72;98.77]% (prediction focus) FPE: 0.5719, MSE: 1.061
Load the estimation data and create an iddata
object z
. z
contains two output channels and six input channels.
load motorizedcamera;
z = iddata(y,u,0.02);
Specify a set of linear regressors that uses the output and input names from z
and contains:
2 output regressors with 1 lag.
6 input regressor pairs with 1 and 2 lags.
names = [z.OutputName; z.InputName]; lags = {1,1,[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]}; reg = linearRegressor(names,lags);
Estimate a nonlinear ARX model using a sigmoidnet
mapping function with four units for all output channels.
sys = nlarx(z,reg,sigmoidnet(4))
sys = Nonlinear ARX model with 2 outputs and 6 inputs Inputs: u1, u2, u3, u4, u5, u6 Outputs: y1, y2 Regressors: Linear regressors in variables y1, y2, u1, u2, u3, u4, u5, u6 List of all regressors Output functions: Output 1: Sigmoid Network with 4 units Output 2: Sigmoid Network with 4 units Sample time: 0.02 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: [98.86;98.79]% (prediction focus) FPE: 2.641, MSE: 0.9233
Load the estimation data z1
, which has one input and one output, and obtain the output and input names.
load iddata1 z1; names = [z1.OutputName z1.InputName]
names = 1×2 cell
{'y1'} {'u1'}
Specify L
as the set of linear regressors that represents ${\mathit{y}}_{1}\left(\mathit{t}1\right)$, ${\mathit{u}}_{1}\left(\mathit{t}2\right)$, and ${\mathit{u}}_{1}\left(\mathit{t}5\right)$.
L = linearRegressor(names,{1,[2 5]});
Specify P
as the polynomial regressor ${{\mathit{y}}_{1}\left(\mathit{t}1\right)}^{2}$.
P = polynomialRegressor(names(1),1,2);
Specify C
as the custom regressor ${\mathit{y}}_{1}\left(\mathit{t}2\right)$${\mathit{u}}_{1}\left(\mathit{t}3\right)$. Use an anonymous function handle to define this function.
C = customRegressor(names,{2 3},@(x,y)x.*y)
C = Custom regressor: y1(t2).*u1(t3) VariablesToRegressorFcn: @(x,y)x.*y Variables: {'y1' 'u1'} Lags: {[2] [3]} Vectorized: 1 TimeVariable: 't' Regressors described by this set
Combine the regressors in the column vector R
.
R = [L;P;C]
R=3×1 object
[3 1] array of linearRegressor, polynomialRegressor, customRegressor objects.

1. Linear regressors in variables y1, u1
Variables: {'y1' 'u1'}
Lags: {[1] [2 5]}
UseAbsolute: [0 0]
TimeVariable: 't'

2. Order 2 regressors in variables y1
Order: 2
Variables: {'y1'}
Lags: {[1]}
UseAbsolute: 0
AllowVariableMix: 0
AllowLagMix: 0
TimeVariable: 't'

3. Custom regressor: y1(t2).*u1(t3)
VariablesToRegressorFcn: @(x,y)x.*y
Variables: {'y1' 'u1'}
Lags: {[2] [3]}
Vectorized: 1
TimeVariable: 't'
Regressors described by this set
Estimate a nonlinear ARX model with R
.
sys = nlarx(z1,R)
sys = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: 1. Linear regressors in variables y1, u1 2. Order 2 regressors in variables y1 3. Custom regressor: y1(t2).*u1(t3) List of all regressors Output function: Wavelet Network with 1 unit Sample time: 0.1 seconds Status: Estimated using NLARX on time domain data "z1". Fit to estimation data: 59.73% (prediction focus) FPE: 3.356, MSE: 3.147
View the full regressor set.
getreg(sys)
ans = 5×1 cell
{'y1(t1)' }
{'u1(t2)' }
{'u1(t5)' }
{'y1(t1)^2' }
{'y1(t2).*u1(t3)'}
Load the estimation data.
load iddata1;
Create a sigmoid network mapping object with 10 units and no linear term.
SN = sigmoidnet(10,false);
Estimate the nonlinear ARX model. Confirm that the model does not use the linear function.
sys = nlarx(z1,[2 2 1],SN); sys.OutputFcn.LinearFcn.Use
ans = logical
0
Load the estimation data.
load throttledata;
Detrend the data.
Tr = getTrend(ThrottleData); Tr.OutputOffset = 15; DetrendedData = detrend(ThrottleData,Tr);
Estimate the linear ARX model.
LinearModel = arx(DetrendedData,[2 1 1]);
Estimate the nonlinear ARX model using the linear model. The model orders, delays, and linear parameters of NonlinearModel
are derived from LinearModel
.
NonlinearModel = nlarx(ThrottleData,LinearModel)
NonlinearModel = Nonlinear ARX model with 1 output and 1 input Inputs: Step Command Outputs: Throttle Valve Position Regressors: Linear regressors in variables Throttle Valve Position, Step Command List of all regressors Output function: Wavelet Network with 7 units Sample time: 0.01 seconds Status: Estimated using NLARX on time domain data "ThrottleData". Fit to estimation data: 99.03% (prediction focus) FPE: 0.1127, MSE: 0.1039
idnlarx
ObjectLoad the estimation data.
load iddata1;
Create an idnlarx
model.
sys = idnlarx([2 2 1]);
Configure the model using dot notation to:
Use a sigmoid network mapping object.
Assign a name.
sys.Nonlinearity = 'sigmoidnet'; sys.Name = 'Model 1';
Estimate a nonlinear ARX model with the structure and properties specified in the idnlarx
object.
sys = nlarx(z1,sys)
sys = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 List of all regressors Output function: Sigmoid Network with 10 units Name: Model 1 Sample time: 0.1 seconds Status: Estimated using NLARX on time domain data "z1". Fit to estimation data: 69.03% (prediction focus) FPE: 2.918, MSE: 1.86
If an estimation stops at a local minimum, you can perturb the model using init
and reestimate the model.
Load the estimation data.
load iddata1;
Estimate the initial nonlinear model.
sys1 = nlarx(z1,[4 2 1],'sigmoidnet');
Randomly perturb the model parameters to avoid local minima.
sys2 = init(sys1);
Estimate the new nonlinear model with the perturbed values.
sys2 = nlarx(z1,sys1);
Load the estimation data.
load twotankdata;
Create an iddata
object from the estimation data.
z = iddata(y,u,0.2);
Create an nlarxOptions
option set specifying a simulation error minimization objective and a maximum of 50 estimation iterations.
opt = nlarxOptions;
opt.Focus = 'simulation';
opt.SearchOptions.MaxIterations = 50;
Estimate the nonlinear ARX model.
sys = nlarx(z,[4 4 1],'sigmoidnet',opt)
sys = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 List of all regressors Output function: Sigmoid Network with 10 units Sample time: 0.2 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: 88.79% (simulation focus) FPE: 3.341e05, MSE: 0.0004307
Load the regularization example data.
load regularizationExampleData.mat nldata;
Create a sigmoidnet
mapping object with 30 units and specify the model orders.
MO = sigmoidnet(30); Orders = [1 2 1];
Create an estimation option set and set the estimation search method to lm
.
opt = nlarxOptions('SearchMethod','lm');
Estimate an unregularized model.
sys = nlarx(nldata,Orders,MO,opt);
Configure the regularization Lambda
parameter.
opt.Regularization.Lambda = 1e8;
Estimate a regularized model.
sysR = nlarx(nldata,Orders,MO,opt);
Compare the two models.
compare(nldata,sys,sysR)
The large negative fit result for the unregularized model indicates a poor fit to the data. Estimating a regularized model produces a significantly better result.
data
— Timedomain estimation dataiddata
object  numeric matrixTimedomain estimation data, specified as an iddata
object or a numeric matrix.
If data
is an iddata
object, then
data
can have one or more output channels and zero
or more input channels.
If data
is a numeric matrix, then the number of
columns of data must match the sum of the number of inputs
(n_{u}) and the number of
outputs ( n_{y}.
data
must be uniformly sampled and cannot contain
missing (NaN
) samples.
orders
— ARX model ordersnlarx
orders [na nb nk]
ARX model orders, specified as the matrix [na nb nk]
.
na
denotes the number of delayed outputs,
nb
denotes the number of delayed inputs, and
nk
denotes the minimum input delay. The minimum
output delay is fixed to 1
. For more information on how
to construct the orders
matrix, see arx
.
When you specify orders
, the software converts the
order information into linear regressor form in the idnlarx
Regressors
property. For an example, see
Create Nonlinear ARX Model Using ARX Model Orders.
regressors
— Regressor specificationlinearRegressor
object  polynomialRegressor
object  customRegressor
object  column array of regressor specification objectsRegressor specification, specified as a column vector containing one or
more regressor specification objects, which are the linearRegressor
objects, polynomialRegressor
objects, and
customRegressor
objects. Each object
specifies a formula for generating regressors from lagged variables. For example:
L = linearRegressor({'y1','u1'},{1,[2 5]})
generates the regressors
y_{1}(t–1),
u_{1}(t–2),
and
u_{2}(t–5).
P = polynomialRegressor('y2',4:7,2)
generates the regressors
y_{2}(t–4)^{2},
y_{2}(t–5)^{2},
y_{2}(t–6)^{2},
and
y_{2}(t–7)^{2}.
C = customRegressor({'y1','u1','u2'},{1 2
2},@(x,y,z)sin(x.*y+z))
generates the single
regressor
sin(y_{1}(t–1)u_{1}(t–2)+u_{2}(t–2)).
When you create a regressor set to support estimation with an
iddata
object, you can use the input and output names
of the object rather than create the names for the regressor function. For
instance, suppose you create a linear regressor for a model, plan to use the
iddata
object z
to estimate the
model. You can use the following command to create the linear regressor.
L = linearRegressor([z.outputName;z.inputName],{1,[2 5]})
For an example of creating and using a SISO linear regressor set, see Estimate Nonlinear ARX Model Using Linear Regressor Set. For an example of creating a MIMO linear regressor set that obtains variable names from the estimation data set, see Estimate MIMO Nonlinear ARX Model with Same Mapping Function for All Outputs.
output_fcn
— Output function'wavenet'
(default)  'linear'
 []
 ''
 'sigmoidnet'
 'treepartition'
 'neuralnet'
 'customnet'
 mapping object  array of mapping objectsOutput function that maps the regressors of the idnlarx
model into the model output, specified as a column array containing zero or
more of the following strings or objects:
'wavenet' or wavenet
object  Wavelet network 
'linear' or ''
or [] or linear
object  Linear function 
'sigmoidnet' or sigmoidnet
object  Sigmoid network 
'treepartition' or treepartition object  Binary tree partition regression model 
neuralnet
object  Neural network — Feedforward network of Deep Learning Toolbox™. 
customnet object  Custom network — Similar to
sigmoidnet , but with a
userdefined replacement for the sigmoid
function. 
Use a string, such as 'sigmoidnet'
, to use the default
properties of the mapping function object. Use the object itself, such as
sigmoidnet
, when you want to configure the
properties of the mapping object.
The wavenet
, sigmoidnet
,
treepartion
, and customnet
objects contain both linear and nonlinear components. You can remove (not
use) the linear components of wavenet
,
sigmoidnet
, and customnet
by
setting the LinearFcn.Use
value to
false
.
The neuralnet
function has only a nonlinear
component, which is the network
(Deep Learning Toolbox) object of
Deep Learning Toolbox. The linear function, as the name implies, has only a linear
component.
output_fcn
is static in that it depends only upon the
data values at a specific time, but not directly on time itself. For
example, if the output function y(t)
is equal to y_{0} +
a_{1}
y(t–1) +
a_{2}
y(t–2) + …
b_{1}
u(t–1) +
b_{2}
u(t–2) + …, then
output_fcn
is a linear function that the
linear
mapping object represents.
Specifying a character vector, for example
'sigmoidnet'
, creates a mapping object with default
settings. Alternatively, you can specify mapping object properties in two
ways:
Create the mapping object using arguments to modify default properties.
MO = sigmoidnet(15);
Create a default mapping object first and then use dot notation to modify properties.
MO = sigmoidnet; MO.NumberOfUnits = 15;
For n_{y} output channels, you can
specify mapping objects individually for each channel by setting
output_fcn
to an array of
n_{y} mapping objects. For
example, the following code specifies OutputFcn
using
dot notation for a system with two input channels and two output channels.
sys = idnlarx({'y1','y2'},{'u1','u2'}); sys.OutputFcn = [wavenet; sigmoidnet];
OutputFcn
as a character vector or a single mapping
object.
output_fcn
represents a static mapping function that
transforms the regressors of the nonlinear ARX model into the model output.
output_fcn
is static because it does not depend on
time. For example, if $$y(t)={y}_{0}+{a}_{1}y(t1)+{a}_{2}y(t2)+\dots +{b}_{1}u(t1)+{b}_{2}u(t2)+\dots $$, then output_fcn
is a linear function
represented by the linear
object.
For an example of specifying the output function, see Specify and Customize Output Function.
linmodel
— Discretetime linear modelidpoly
object  idss
object  idtf
object  idproc
objectsys0
— Nonlinear ARX modelidnlarx
modelNonlinear ARX model, specified as an idnlarx
model.
sys0
can be:
A model previously estimated using nlarx
. The
estimation algorithm uses the parameters of
sys0
as initial guesses. In this case, use
init
to slightly
perturb the model properties to avoid trapping the model in local
minima.
sys = init(sys); sys = nlarx(data,sys);
A model previously created using the idnlarx
constructor and with properties set using dot notation. For example,
use the following to create an idnlarx object, set its properties,
and estimate the model.
sys1 = idnlarx('y1','u1',Regressors); sys1.OutputFcn = 'treepartition'; sys1.Ts = 0.02; sys1.TimeUnit = 'Minutes'; sys1.InputName = 'My Data'; sys2 = nlarx(data,sys1);
The preceding code is equivalent to the following nlarx command.
sys2 = nlarx(data,Regressors,'treepartition','Ts',0.02,'TimeUnit','Minutes', ... 'InputName','My Data');
Options
— Estimation optionsnlarxOptions
option setEstimation options for nonlinear ARX model identification, specified as an
nlarxOptions
option
set.
sys
— Nonlinear ARX modelidnlarx
objectNonlinear ARX model that fits the given estimation data, returned as an
idnlarx
object. This model
is created using the specified model orders, nonlinearity estimator, and
estimation options.
Information about the estimation results and options used is stored in the
Report
property of the model. The contents of
Report
depend upon the choice of nonlinearity and
estimation focus you specified for nlarx
.
Report
has the following fields:
Report Field  Description  

Status  Summary of the model status, which indicates whether the model was created by construction or obtained by estimation.  
Method  Estimation command used.  
Fit  Quantitative assessment of the estimation, returned as a structure. See Loss Function and Model Quality Metrics for more information on these quality metrics. The structure has the following fields:
 
Parameters  Estimated values of model parameters.  
OptionsUsed  Option set used for estimation. If no custom
options were configured, this is a set of default
options. See  
RandState  State of the random number stream at the start of estimation. Empty,
 
DataUsed  Attributes of the data used for estimation, returned as a structure with the following fields:
 
Termination  Termination conditions for the iterative search used for prediction error minimization, returned as a structure with the following fields:
For estimation methods that do not require numerical search optimization,
the 
For more information on using Report
, see Estimation Report.
A nonlinear ARX model consists of model regressors and an output function. The output function includes linear and nonlinear functions that act on the model regressors to give the model output and a fixed offset for that output. This block diagram represents the structure of a nonlinear ARX model in a simulation scenario.
The software computes the nonlinear ARX model output y in two stages:
It computes regressor values from the current and past input values and the past output data.
In the simplest case, regressors are delayed inputs and outputs, such as
u(t–1) and
y(t–3). These kind of regressors are
called linear regressors. You specify linear regressors using
the linearRegressor
object. You can also specify linear regressors by
using linear ARX model orders as an input argument. For more information, see
Nonlinear ARX Model Orders and Delay. However, this second approach
constrains your regressor set to linear regressors with consecutive delays. To
create polynomial regressors, use the polynomialRegressor
object. You can also specify custom
regressors, which are nonlinear functions of delayed inputs and
outputs. For example,
u(t–1)y(t–3)
is a custom regressor that multiplies instances of input and output together.
Specify custom regressors using the customRegressor
object.
You can assign any of the regressors as inputs to the linear function block of the output function, the nonlinear function block, or both.
It maps the regressors to the model output using an output function block. The output function block can include linear and nonlinear blocks in parallel. For example, consider the following equation:
$$F(x)={L}^{T}(xr)+g\left(Q(xr)\right)+d$$
Here, x is a vector of the regressors, and r is the mean of x. $$F(x)={L}^{T}(xr)+{y}_{0}$$ is the output of the linear function block. $$g\left(Q(xr)\right)+{y}_{0}$$ represents the output of the nonlinear function block. Q is a projection matrix that makes the calculations wellconditioned. d is a scalar offset that is added to the combined outputs of the linear and nonlinear blocks. The exact form of F(x) depends on your choice of output function. You can select from the available mapping objects, such as treepartition networks, wavelet networks, and multilayer neural networks. You can also exclude either the linear or the nonlinear function block from the output function.
When estimating a nonlinear ARX model, the software computes the model parameter values, such as L, r, d, Q, and other parameters specifying g.
The resulting nonlinear ARX models are idnlarx
objects that store all model data, including model regressors and
parameters of the output function. For more information about these objects, see Nonlinear Model Structures.
idnlarx
properties is not recommended.Not recommended starting in R2021a
Starting in R2021a, several properties of idnlarx
have been modified or
replaced.
These changes affect the syntaxes in both idnlarx
and
nlarx
. The use of the preR2021a properties in the
following table is discouraged. However, the software still accepts calling syntaxes
that include these properties. There are no plans to exclude these syntaxes at this
time. The command syntax that uses ARX model orders continues be a recommended
syntax.
PreR2021a Property  R2021a Property  Usage 

ARX model orders na,nb,nk  Regressors , which can include linearRegressor , polynomialRegressor , and customRegressor objects. 
You
can no longer change order values in an existing

customRegressors  Regressors  Use polynomialRegressor or customRegressor to create regressor objects and
add the objects to the Regressors array.

NonlinearRegressors  RegressorUsage  RegressorUsage is a table that contains
regressor assignments to linear and nonlinear output components.
Change assignments by modifying the corresponding
RegressorUsage table entries. 
Nonlinearity  OutputFcn  Change is in name only. Property remains an object or an array or objects that map regressor inputs to an output. 
Parallel computing support is available for estimation using the
lsqnonlin
search method (requires Optimization Toolbox™). To enable parallel computing, use nlarxOptions
, set SearchMethod
to
'lsqnonlin'
, and set
SearchOptions.Advanced.UseParallel
to
true
, as in the following
example.
opt = nlarxOptions;
opt.SearchMethod = 'lsqnonlin';
opt.SearchOptions.Advanced.UseParallel = true;
aic
 fpe
 goodnessOfFit
 idnlarx
 isnlarx
 linearRegressor
 nlarxOptions
 polynomialRegressor
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.