Estimate parameters of nonlinear ARX model
estimates a nonlinear ARX model using the specified regressor setsys
= nlarx(data
,regressors
)regressors
。Use this syntax when you have linear regressors that have non-consecutive lags, or when you also have polynomial regressors, custom regressors, or both.
指定地图的输出函数回归sors to the model output. You can use this syntax with any of the previous input argument combinations.sys
= nlarx(___,output_fcn
)
uses a linear ARX modelsys
= nlarx(data
,linmodel
)linmodel
指定模型订单和初始值of the linear coefficients of the model. Use this syntax when you want to create a nonlinear ARX model as an extension of, or an improvement upon, an existing linear model. When you use this syntax, the software initializes the offset value to0
。In some cases, you can improve the estimation results by overriding this initialization with the commandsys.OutputFcn.Offset.Value = NaN
。
specifies the output function to use for model estimation.sys
= nlarx(data
,linmodel
,output_fcn
)
estimates or refines the parameters of the nonlinear ARX modelsys
= nlarx(data
,sys0
)sys0
。
Use this syntax to:
Estimate the parameters of a model previously created using theidnlarx
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 ofsys0
as initial guesses.
Load the estimation data.
loadtwotankdata;
Create aniddata
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.482e-05, MSE: 3.431e-05
sys
uses the defaultidWaveletNetwork
function as the output function.
For comparison, compute a linear ARX model with the same model orders.
sysL = arx(z,[4 4 1]);
比较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,
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.
loadtwotankdataz = 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.482e-05, MSE: 3.431e-05
View the regressors
getreg(sys)
ans =8x1 cell{'y1(t-1)'} {'y1(t-2)'} {'y1(t-3)'} {'y1(t-4)'} {'u1(t-1)'} {'u1(t-2)'} {'u1(t-3)'} {'u1(t-4)'}
比较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 aniddata
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 functionidSigmoidNetwork
as its output function.
Load the data and divide it into the estimation and validation data setsze
andzv
。
loadtwotankdata.matuyz = iddata(y,u,'Ts',0.2); ze = z(1:1500); zv = z(1501:end);
Configure theidSigmoidNetwork
mapping function. Fix the offset to 0.2 and the number of units to 15.
s = idSigmoidNetwork; 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);
Validatesys
by comparing the simulated model response to the validation data set.
compare(zv,sys)
Estimate a linear model and improve the model by adding atreepartition
output function.
Load the estimation data.
loadthrottledataThrottleData
Estimate a linear ARX modellinsys
with orders[2 2 1]
。
linsys = arx(ThrottleData,[2 2 1]);
Create anidnlarx
template model that useslinsys
and specifiessigmoidnet
as the output function.
sys0 = idnlarx(linsys,idTreePartition);
Fix the linear component ofsys0
so that during estimation, the linear portion ofsys0
remains identical tolinsys
。设置组件val抵消ue toNaN
。
sys0.OutputFcn.LinearFcn。自由=false; sys0.OutputFcn.Offset.Value = NaN;
Estimate the free parameters ofsys0
, which are the nonlinear-function 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 user-defined unit function.
Define the unit function and save it asgaussunit.m
。
function[f,g,a] = gaussunit(x)% Custom unit function nonlinearity.%% Copyright 2015 The MathWorks, Inc.f = exp(-x.*x);ifnargout>1 g = -2*x.*f; a = 0.2;end
Create a custom network mapping object using a handle to thegaussunit
function.
H = @gaussunit; CNet = idCustomNetwork(H);
Load the estimation data.
loadiddata1
Estimate a nonlinear ARX model using the custom network.
sys = nlarx(z1,[1 2 1],CNet)
sys = Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 Output function: Custom Network with 10 units and "gaussunit" unit function 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.
loadmotorizedcamera;
Create aniddata
object.
z = iddata(y,u,0.02,'Name','Motorized Camera','TimeUnit','s');
z
is aniddata
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 = [idWaveletNetwork(2),idLinear];
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: None 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 aniddata
objectz
。z
包含两个输出通道和六个输入通道s.
loadmotorizedcamera; z = iddata(y,u,0.02);
Specify a set of linear regressors that uses the output and input names fromz
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 anidSigmoidNetwork
mapping function with four units for all output channels.
sys = nlarx(z,reg,idSigmoidNetwork(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 dataz1
, which has one input and one output, and obtain the output and input names.
loadiddata1z1; names = [z1.OutputName z1.InputName]
names =1x2 cell{'y1'} {'u1'}
SpecifyL
as the set of linear regressors that represents
,
, and
。
L = linearRegressor(names,{1,[2 5]});
SpecifyP
as the polynomial regressor
。
P = polynomialRegressor(names(1),1,2);
SpecifyC
as the custom regressor
。Use an anonymous function handle to define this function.
C = customRegressor(names,{2 3},@(x,y)x.*y)
C = Custom regressor: y1(t-2).*u1(t-3) 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 vectorR
。
R = [L;P;C]
1 R =[3]数组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(t-2).*u1(t-3) 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 withR
。
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(t-2).*u1(t-3) List of all regressors Output function: Wavelet network with 1 units 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 =5x1 cell{'y1(t-1)' } {'u1(t-2)' } {'u1(t-5)' } {'y1(t-1)^2' } {'y1(t-2).*u1(t-3)'}
Load the estimation data.
loadiddata1;
Create a sigmoid network mapping object with 10 units and no linear term.
SN = idSigmoidNetwork(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 =logical0
Load the estimation data.
loadthrottledata;
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 ofNonlinearModel
are derived fromLinearModel
。
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 12 units Sample time: 0.01 seconds Status: Estimated using NLARX on time domain data "ThrottleData". Fit to estimation data: 65.67% (prediction focus) FPE: 145.7, MSE: 130
idnlarx
ObjectLoad the estimation data.
loadiddata1;
Create anidnlarx
model.
sys = idnlarx([2 2 1]);
Configure the model using dot notation to:
Use a sigmoid network mapping object.
Assign a name.
sys.Nonlinearity ='idSigmoidNetwork'; sys.Name ='Model 1';
Estimate a nonlinear ARX model with the structure and properties specified in theidnlarx
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 usinginit
and re-estimate the model.
Load the estimation data.
loadiddata1;
Estimate the initial nonlinear model.
sys1 = nlarx(z1,[4 2 1],'idSigmoidNetwork');
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.
loadtwotankdata;
Create aniddata
object from the estimation data.
z = iddata(y,u,0.2);
Create annlarxOptions
option set specifying a simulation error minimization objective and a maximum of 10 estimation iterations.
opt = nlarxOptions; opt.Focus ='simulation'; opt.SearchOptions.MaxIterations = 10;
Estimate the nonlinear ARX model.
sys = nlarx(z,[4 4 1],idSigmoidNetwork(3),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 3 units Sample time: 0.2 seconds Status: Estimated using NLARX on time domain data "z". Fit to estimation data: 85.86% (simulation focus) FPE: 3.791e-05, MSE: 0.0006853
Load the regularization example data.
loadregularizationExampleData.matnldata;
Create anidSigmoidnetwork
mapping object with 30 units and specify the model orders.
MO = idSigmoidNetwork(30); Orders = [1 2 1];
Create an estimation option set and set the estimation search method tolm
。
opt = nlarxOptions('SearchMethod','lm');
Estimate an unregularized model.
sys = nlarx(nldata,Orders,MO,opt);
Configure the regularizationLambda
parameter.
opt.Regularization.Lambda = 1e-8;
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
—Time-domain estimation dataiddata
object|numeric matrixTime-domain estimation data, specified as aniddata
object or a numeric matrix.
Ifdata
is aniddata
object, thendata
can have one or more output channels and zero or more input channels.
Ifdata
is a numeric matrix, then the number of columns of data must match the sum of the number of inputs (nu) and the number of outputs (ny。
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, andnk
denotes the minimum input delay. The minimum output delay is fixed to1
。For more information on how to construct theorders
matrix, seearx
。
When you specifyorders
, the software converts the order information into linear regressor form in theidnlarx
Regressors
property. For an example, seeCreate 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 thelinearRegressor
objects,polynomialRegressor
objects, andcustomRegressor
objects. Each object specifies a formula for generating regressors from lagged variables. For example:
L = linearRegressor({'y1','u1'},{1,[2 5]})
generates the regressorsy1(t–1),u1(t–2), andu2(t–5).
P = polynomialRegressor('y2',4:7,2)
generates the regressorsy2(t–4)2,y2(t–5)2,y2(t–6)2, andy2(t–7)2。
C = customRegressor({'y1','u1','u2'},{1 2 2},@(x,y,z)sin(x.*y+z))
generates the single regressor sin(y1(t–1)u1(t–2)+u2(t–2)).
When you create a regressor set to support estimation with aniddata
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 theiddata
objectz
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, seeEstimate 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, seeEstimate MIMO Nonlinear ARX Model with Same Mapping Function for All Outputs。
output_fcn
—Output function'idWaveletNetwork'
(default) |'idLinear'
|[]
|''
|'idSigmoidNetwork'
|'idTreePartition'
|'idFeedforwardNetwork'
|'idCustomNetwork'
|'idTreePartition'
|'idGaussianProcess'
|'idTreeEnsemble'
|mapping object|array of mapping objectsOutput function that maps the regressors of theidnlarx
model into the model output, specified as a column array containing zero or more of the following strings or objects:
'idWaveletNetwork' oridWaveletNetwork object |
Wavelet network |
'linear' or'' or[] oridLinear object |
Linear function |
'idSigmoidNetwork' oridSigmoidNetwork object |
Sigmoid network |
'idTreePartition' oridTreePartition object |
Binary tree partition regression model |
'idGaussianProcess' oridGaussianProcess object |
Gaussian process regression model (requires Statistics and Machine Learning Toolbox™) |
'idTreeEnsemble' oridTreeEnsemble |
Regression tree ensemble model requires (Statistics and Machine Learning Toolbox) |
idFeedforwardNetwork object |
Neural network — Feedforward network of Deep Learning Toolbox™. |
idCustomNetwork object |
Custom network — Similar toidSigmoidNetwork , but with a user-defined replacement for the sigmoid function. |
Use a string, such as'idSigmoidNetwork'
, to use the default properties of the mapping function object. Use the object itself, such asidSigmoidNetwork
, when you want to configure the properties of the mapping object.
TheidWaveletNetwork
,idSigmoidNetwork
,idTreePartition
, andidCustomNetwork
objects contain both linear and nonlinear components. You can remove (not use) the linear components ofidWaveletNetwork
,idSigmoidNetwork
, andidCustomNetwork
by setting theLinearFcn.Use
value tofalse
。
TheidFeedforwardNetwork
function has only a nonlinear component, which is thenetwork
(Deep Learning Toolbox)object of Deep Learning Toolbox. TheidLinear
object, 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 functiony(t) is equal toy0+a1y(t–1) +a2y(t–2) + …b1u(t–1) +b2u(t–2) + …, thenoutput_fcn
is a linear function that thelinear
mapping object represents.
Specifying a character vector, for example'idSigmoidNetwork'
, 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 = idSigmoidNetwork(15);
Create a default mapping object first and then use dot notation to modify properties.
MO = idSigmoidNetwork; MO.NumberOfUnits = 15;
Fornyoutput channels, you can specify mapping objects individually for each channel by settingoutput_fcn
to an array ofnymapping objects. For example, the following code specifiesOutputFcn
using dot notation for a system with two input channels and two output channels.
sys = idnlarx({'y1','y2'},{'u1','u2'}); sys.OutputFcn = [idWaveletNetwork; idSigmoidNetwork];
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
, thenoutput_fcn
is a linear function represented by theidLinear
object.
For an example of specifying the output function, seeSpecify and Customize Output Function。
linmodel
—Discrete-time linear modelidpoly
object|idss
object|idtf
object|idproc
objectsys0
—Nonlinear ARX modelidnlarx
modelNonlinear ARX model, specified as anidnlarx
model.sys0
can be:
A model previously estimated usingnlarx
。The estimation algorithm uses the parameters ofsys0
as initial guesses. In this case, useinit
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 theidnlarx
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 ='idTreePartition'; 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,'idTreePartition','Ts',0.02,'TimeUnit','Minutes',。..'InputName','My Data');
Options
—Estimation optionsnlarxOptions
option setEstimation options for nonlinear ARX model identification, specified as annlarxOptions
option set.
sys
— Nonlinear ARX modelidnlarx
objectNonlinear ARX model that fits the given estimation data, returned as anidnlarx
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 theReport
property of the model. The contents ofReport
depend upon the choice of nonlinearity and estimation focus you specified fornlarx
。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. SeeLoss Function and Model Quality Metricsfor 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 usingReport
, seeEstimation 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 outputyin 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 asu(t–1) andy(t–3). These kind of regressors are calledlinear regressors。You specify linear regressors using thelinearRegressor
object. You can also specify linear regressors by using linear ARX model orders as an input argument. For more information, see非线性ARX模型订单和延迟。However, this second approach constrains your regressor set to linear regressors with consecutive delays. To createpolynomial regressors, use thepolynomialRegressor
object. You can also specifycustom 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 thecustomRegressor
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:
Here,xis a vector of the regressors, andris the mean ofx。 is the output of the linear function block. represents the output of the nonlinear function block.Qis a projection matrix that makes the calculations well-conditioned.dis a scalar offset that is added to the combined outputs of the linear and nonlinear blocks. The exact form ofF(x) depends on your choice of output function. You can select from theavailable mapping objects, such as tree-partition 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 asL,r,d,Q, and other parameters specifyingg。
The resulting nonlinear ARX models areidnlarx
objects that store all model data, including model regressors and parameters of the output function. For more information about these objects, seeNonlinear Model Structures。
idnlarx
andidnlhw
mapping object names is not recommended.Not recommended starting in R2021b
Starting in R2021b, the mapping objects (also known as nonlinearities) used in the nonlinear components of theidnlarx
andidnlhw
objects have been renamed. The following table lists the name changes.
Pre-R2021b Name | R2021b Name |
---|---|
wavenet |
idWaveletNetwork |
sigmoidnet |
idSigmoidNetwork |
treepartition |
idTreePartition |
customnet |
idCustomNetwork |
saturation |
idSaturation |
deadzone |
idDeadZone |
pwlinear |
idPiecewiseLinear |
poly1d |
idPolynomial1D |
unitgain |
idUnitGain |
linear |
idLinear |
neuralnet |
idFeedforwardNetwork |
Scripts with the old names still run normally, although they will produce a warning. Consider using the new names for continuing compatibility with newly developed features and algorithms. There are no plans to exclude the use of these object names at this time
idnlarx
properties is not recommended.Not recommended starting in R2021a
Starting in R2021a, several properties ofidnlarx
have been modified or replaced.
These changes affect the syntaxes in bothidnlarx
andnlarx
。The use of the pre-R2021a 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.
Pre-R2021a Property | R2021a Property | Usage |
---|---|---|
ARX model ordersna,nb,nk |
Regressors , which can includelinearRegressor ,polynomialRegressor , andcustomRegressor objects. |
You can no longer change order values in an existing |
customRegressors |
Regressors |
UsepolynomialRegressor orcustomRegressor to create regressor objects and add the objects to theRegressors array. |
NonlinearRegressors |
RegressorUsage |
RegressorUsage is a table that contains regressor assignments to linear and nonlinear output components. Change assignments by modifying the correspondingRegressorUsage 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 thelsqnonlin
search method (requires Optimization Toolbox™). To enable parallel computing, usenlarxOptions
, setSearchMethod
to'lsqnonlin'
, and setSearchOptions.Advanced.UseParallel
totrue
, as in the following example.
opt = nlarxOptions; opt.SearchMethod ='lsqnonlin'; opt.SearchOptions.Advanced.UseParallel = true;
idnlarx
|nlarxOptions
|isnlarx
|goodnessOfFit
|aic
|fpe
|polynomialRegressor
|linearRegressor
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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:。
Selectweb 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.