Main Content

nlarx

Estimate parameters of nonlinear ARX model

Description

Specify Regressors

example

sys= nlarx(data,orders)estimates a nonlinear ARX model to fit the given estimation data using the specified ARX model orders and the default wavelet network output function. Use this syntax when you extend an ARX linear model, or when you use only regressors that are linear with consecutive lags.

example

sys= nlarx(data,regressors)estimates a nonlinear ARX model using the specified regressor setregressors。Use this syntax when you have linear regressors that have non-consecutive lags, or when you also have polynomial regressors, custom regressors, or both.

example

sys= nlarx(___,output_fcn)指定地图的输出函数回归sors to the model output. You can use this syntax with any of the previous input argument combinations.

Specify Linear Model

example

sys= nlarx(data,linmodel)uses a linear ARX modellinmodel指定模型订单和初始值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

example

sys= nlarx(data,linmodel,output_fcn)specifies the output function to use for model estimation.

Refine Existing Model

example

sys= nlarx(data,sys0)estimates or refines the parameters of the nonlinear ARX modelsys0

Use this syntax to:

  • Estimate the parameters of a model previously created using theidnlarxconstructor. 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 ofsys0as initial guesses.

Specify Options

example

sys= nlarx(___,Options)specifies additional configuration options for the model estimation.

Examples

collapse all

Load the estimation data.

loadtwotankdata;

Create aniddataobject 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

sysuses the defaultidWaveletNetworkfunction 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)

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent z (y1), sysNL: 82.73%, sysL: 51.41%.

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, u 1 ( t - 2 ) 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)

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent z (y1), sys: 82.73%.

Create time and data arrays.

dt = 0.01; t = 0:dt:10; y = 10*sin(2*pi*t)+rand(size(t));

Create aniddataobject 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 functionidSigmoidNetworkas its output function.

Load the data and divide it into the estimation and validation data setszeandzv

loadtwotankdata.matuyz = iddata(y,u,'Ts',0.2); ze = z(1:1500); zv = z(1501:end);

Configure theidSigmoidNetworkmapping 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);

Validatesysby comparing the simulated model response to the validation data set.

compare(zv,sys)

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent zv (y1), sys: 89.75%.

Estimate a linear model and improve the model by adding atreepartitionoutput function.

Load the estimation data.

loadthrottledataThrottleData

Estimate a linear ARX modellinsyswith orders[2 2 1]

linsys = arx(ThrottleData,[2 2 1]);

Create anidnlarxtemplate model that useslinsysand specifiessigmoidnetas the output function.

sys0 = idnlarx(linsys,idTreePartition);

Fix the linear component ofsys0so that during estimation, the linear portion ofsys0remains 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)

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent ThrottleData (Throttle Valve Position), linsys: 64.45%, sys: 90.32%.

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 thegaussunitfunction.

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 aniddataobject.

z = iddata(y,u,0.02,'Name','Motorized Camera','TimeUnit','s');

zis aniddataobject 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 aniddataobjectzz包含两个输出通道和六个输入通道s.

loadmotorizedcamera; z = iddata(y,u,0.02);

Specify a set of linear regressors that uses the output and input names fromzand 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 anidSigmoidNetworkmapping 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'}

SpecifyLas the set of linear regressors that represents y 1 ( t - 1 ) , u 1 ( t - 2 ) , and u 1 ( t - 5 )

L = linearRegressor(names,{1,[2 5]});

SpecifyPas the polynomial regressor y 1 ( t - 1 ) 2

P = polynomialRegressor(names(1),1,2);

SpecifyCas the custom regressor y 1 ( t - 2 ) u 1 ( t - 3 ) 。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 ofNonlinearModelare 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

Load the estimation data.

loadiddata1;

Create anidnlarxmodel.

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 theidnlarxobject.

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 usinginitand 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 aniddataobject from the estimation data.

z = iddata(y,u,0.2);

Create annlarxOptionsoption 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 anidSigmoidnetworkmapping 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 regularizationLambdaparameter.

opt.Regularization.Lambda = 1e-8;

Estimate a regularized model.

sysR = nlarx(nldata,Orders,MO,opt);

Compare the two models.

compare(nldata,sys,sysR)

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent nldata (y1), sys: -7.404e+04%, sysR: 98.63%.

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.

Input Arguments

collapse all

Time-domain estimation data, specified as aniddataobject or a numeric matrix.

  • Ifdatais aniddataobject, thendatacan have one or more output channels and zero or more input channels.

  • Ifdatais 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

datamust be uniformly sampled and cannot contain missing (NaN) samples.

ARX model orders, specified as the matrix[na nb nk]nadenotes the number of delayed outputs,nbdenotes the number of delayed inputs, andnkdenotes the minimum input delay. The minimum output delay is fixed to1。For more information on how to construct theordersmatrix, seearx

When you specifyorders, the software converts the order information into linear regressor form in theidnlarxRegressorsproperty. For an example, seeCreate Nonlinear ARX Model Using ARX Model Orders

Regressor specification, specified as a column vector containing one or more regressor specification objects, which are thelinearRegressorobjects,polynomialRegressorobjects, andcustomRegressorobjects. 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 aniddataobject, 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 theiddataobjectzto 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 function that maps the regressors of theidnlarxmodel into the model output, specified as a column array containing zero or more of the following strings or objects:

'idWaveletNetwork'oridWaveletNetworkobject Wavelet network
'linear'or''or[]oridLinearobject Linear function
'idSigmoidNetwork'oridSigmoidNetworkobject Sigmoid network
'idTreePartition'oridTreePartitionobject Binary tree partition regression model
'idGaussianProcess'oridGaussianProcessobject Gaussian process regression model (requires Statistics and Machine Learning Toolbox™)
'idTreeEnsemble'oridTreeEnsemble Regression tree ensemble model requires (Statistics and Machine Learning Toolbox)
idFeedforwardNetworkobject Neural network — Feedforward network of Deep Learning Toolbox™.
idCustomNetworkobject 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, andidCustomNetworkobjects contain both linear and nonlinear components. You can remove (not use) the linear components ofidWaveletNetwork,idSigmoidNetwork, andidCustomNetworkby setting theLinearFcn.Usevalue tofalse

TheidFeedforwardNetworkfunction has only a nonlinear component, which is thenetwork(Deep Learning Toolbox)object of Deep Learning Toolbox. TheidLinearobject, as the name implies, has only a linear component.

output_fcnis 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_fcnis a linear function that thelinearmapping 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_fcnto an array ofnymapping objects. For example, the following code specifiesOutputFcnusing dot notation for a system with two input channels and two output channels.

sys = idnlarx({'y1','y2'},{'u1','u2'}); sys.OutputFcn = [idWaveletNetwork; idSigmoidNetwork];
To specify the same mapping for all outputs, specifyOutputFcnas a character vector or a single mapping object.

output_fcnrepresents a static mapping function that transforms the regressors of the nonlinear ARX model into the model output.output_fcnis static because it does not depend on time. For example, if y ( t ) = y 0 + a 1 y ( t 1 ) + a 2 y ( t 2 ) + + b 1 u ( t 1 ) + b 2 u ( t 2 ) + , thenoutput_fcnis a linear function represented by theidLinearobject.

For an example of specifying the output function, seeSpecify and Customize Output Function

Discrete-time identified input/output linear model, specified as any linear model created using an estimator such asarx,armax,tfest, orssest。For example, to create a state-spaceidssmodel, estimate the model usingssest

Nonlinear ARX model, specified as anidnlarxmodel.sys0can be:

  • A model previously estimated usingnlarx。The estimation algorithm uses the parameters ofsys0as initial guesses. In this case, useinitto 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 theidnlarxconstructor 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');

Estimation options for nonlinear ARX model identification, specified as annlarxOptionsoption set.

Output Arguments

collapse all

Nonlinear ARX model that fits the given estimation data, returned as anidnlarxobject. 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 theReportproperty of the model. The contents ofReportdepend upon the choice of nonlinearity and estimation focus you specified fornlarxReporthas 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:

Field Description
FitPercent

Normalized root mean squared error (NRMSE) measure of how well the response of the model fits the estimation data, expressed as the percentagefitpercent= 100(1-NRMSE).

LossFcn

Value of the loss function when the estimation completes.

MSE

Mean squared error (MSE) measure of how well the response of the model fits the estimation data.

FPE

Final prediction error for the model.

AIC

Raw Akaike Information Criteria (AIC) measure of model quality.

AICc

Small-sample-size corrected AIC.

nAIC

Normalized AIC.

BIC

Bayesian Information Criteria (BIC).

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. SeenlarxOptionsfor more information.

RandState

State of the random number stream at the start of estimation. Empty,[], if randomization was not used during estimation. For more information, seerng

DataUsed

Attributes of the data used for estimation, returned as a structure with the following fields.

Field Description
Name

Name of the data set.

Type

Data type.

Length

Number of data samples.

Ts

Sample time.

InterSample

Input intersample behavior, returned as one of the following values:

  • 'zoh'— Zero-order hold maintains a piecewise-constant input signal between samples.

  • 'foh'— First-order hold maintains a piecewise-linear input signal between samples.

  • 'bl'— Band-limited behavior specifies that the continuous-time input signal has zero power above the Nyquist frequency.

InputOffset

Offset removed from time-domain input data during estimation. For nonlinear models, it is[]

OutputOffset

Offset removed from time-domain output data during estimation. For nonlinear models, it is[]

Termination

Termination conditions for the iterative search used for prediction error minimization, returned as a structure with the following fields:

Field Description
WhyStop

Reason for terminating the numerical search.

Iterations

Number of search iterations performed by the estimation algorithm.

FirstOrderOptimality

规范的梯度搜索searc时向量h algorithm terminates.

FcnCount

Number of times the objective function was called.

UpdateNorm

Norm of the gradient search vector in the last iteration. Omitted when the search method is'lsqnonlin'or'fmincon'

LastImprovement

Criterion improvement in the last iteration, expressed as a percentage. Omitted when the search method is'lsqnonlin'or'fmincon'

Algorithm

Algorithm used by'lsqnonlin'or'fmincon'search method. Omitted when other search methods are used.

For estimation methods that do not require numerical search optimization, theTerminationfield is omitted.

For more information on usingReport, seeEstimation Report

Algorithms

collapse all

Nonlinear ARX Model Structure

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.

Regressor block is on the left. Output function is on the right. Output function block contains, from top to bottom, Offset, Nonlinear Function, and Linear Function. The inputs to the Regressor block are system input u and the output of the output function y.

The software computes the nonlinear ARX model outputyin two stages:

  1. 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 thelinearRegressorobject. 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 thepolynomialRegressorobject. 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 thecustomRegressorobject.

    You can assign any of the regressors as inputs to the linear function block of the output function, the nonlinear function block, or both.

  2. 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 ( x r ) + g ( Q ( x r ) ) + d

    Here,xis a vector of the regressors, andris the mean ofx F ( x ) = L T ( x r ) + y 0 is the output of the linear function block. g ( Q ( x r ) ) + y 0 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 areidnlarxobjects that store all model data, including model regressors and parameters of the output function. For more information about these objects, seeNonlinear Model Structures

Compatibility Considerations

expand all

Not recommended starting in R2021b

Not recommended starting in R2021a

Extended Capabilities

Introduced in R2007a