这个主题描述了如何evaluat的软件es the output of nonlinearity estimators and uses this output to compute the response of a nonlinear ARX model.
Simulation and Prediction of Sigmoid Network
This example shows how the software computes the simulated and predicted output of a nonlinear ARX model as a result of evaluating the output of its nonlinearity estimator for given regressor values.
Estimating and Exploring a Nonlinear ARX Model
Estimate nonlinear ARX model with sigmoid network nonlinearity.
Inspect the model properties and estimation result.
Nonlinear ARX model with 1 output and 1 input Inputs: u1 Outputs: y1 Regressors: Linear regressors in variables y1, u1 Output function: Sigmoid network with 10 units Sample time: 0.2 seconds Status: Estimated using NLARX on time domain data "estData". Fit to estimation data: 96.31% (prediction focus) FPE: 4.804e-05, MSE: 4.666e-05
This command provides information about input and output variables, regressors, and nonlinearity estimator.
Inspect the nonlinearity estimator.
NL = Sigmoid Network Inputs: y1(t-1), u1(t) Output: y1 Nonlinear Function: Sigmoid network with 10 units Linear Function: initialized to [-0.161 -0.105] Output Offset: initialized to 0.271 Input: 'Function inputs' Output: 'Function output' LinearFcn: 'Linear function parameters' NonlinearFcn: 'Sigmoid units and their parameters' Offset: 'Offset parameters'
Inspect the sigmoid network parameter values.
Prediction of Output
The model output is:
y1(t)= f(y1(t-1),u1(t))
wherefis the sigmoid network function. The model regressorsy1(t-1)andu1 (t)are inputs to the nonlinearity estimator. Timetis a discrete variable representingkT, wherek = 0, 1, ... ,
andTis the sampling interval. In this example,T=0.2
second.
The output prediction equation is:
yp(t)=f(y1_meas(t-1),u1_meas(t))
whereyp(t)is the predicted value of the response at timet。y1_meas(t-1)andu1_meas(t)are the measured output and input values at timest-1andt, respectively.
电脑及相关知识uting the predicted response includes:
To compute the predicted value of the response using initial conditions and current input:
Estimate model from data and get nonlinearity parameters.
Specify zero initial states.
The model has one state because there is only one delayed termy1(t-1)
。The number of states is equal tosum(getDelayInfo(M))
。
电脑及相关知识ute the predicted output at timet=0.
RegValue
is the vector of regressors att=0
。The predicted output isyp(t=0)=f(y1_meas(t=-1),u1_meas(t=0))。用MATLAB变量,该输出f(0,estData.u(1))
, where
y1_meas(t=0) is the measured output value att=0
, which is toestData.y(1)
。
u1_meas(t=1) is the second input data sampleestData.u(2)
。
Perform one-step-ahead prediction at all time values for which data is available.
This code obtains a matrix of regressorsRegMat
为all the time samples usinggetreg
。RegMat
has as many rows as there are time samples, and as many columns as there are regressors in the model - two, in this example.
These steps are equivalent to the predicted response computed in a single step using predict:
Simulation of Output
The model output is:
y1(t)=f(y1(t-1),u1(t))
wherefis the sigmoid network function. The model regressorsy1(t-1)andu1 (t)are inputs to the nonlinearity estimator. Timetis a discrete variable representingkT, wherek= 0, 1,.., andTis the sampling interval. In this example,T=0.2 second.
The simulated output is:
ys(t) = f(ys(t-1),u1_meas(t))
whereys(t)is the simulated value of the response at timet。The simulation equation is the same as the prediction equation, except that the past output valueys(t-1)
results from the simulation at the previous time step, rather than the measured output value.
电脑及相关知识uting the simulated response includes:
To compute the simulated value of the response using initial conditions and current input:
Estimate model from data and get nonlinearity parameters.
Specify zero initial states.
The model has one state because there is only one delayed termy1(t-1)。The number of states is equal tosum(getDelayInfo(M))
。
电脑及相关知识ute the simulated output at timet=0,ys(t=0)。
RegValue is the vector of regressors att=0.ys(t=0)=f(y1(t=-1),u1_meas(t=0))。用MATLAB变量,该输出f(0,estData.u(1))
, where
y1(t=-1)is the initial statex0 (=0)
。
u1_meas(t=0)is the value of the input att=0, which is the first input data sampleestData.u(1)
。
电脑及相关知识ute the simulated output at timet=1,ys(t=1).
The simulated outputys(t=1)=f(ys(t=0),u1_meas(t=1))。用MATLAB变量,该输出f(ys_0,estData.u(2))
, where
电脑及相关知识ute the simulated output at timet=2.
Unlike for output prediction, you cannot usegetreg
to compute regressor values for all time values. You must compute regressors values at each time sample separately because the output samples required for forming the regressor vector are available iteratively, one sample at a time.
These steps are equivalent to the simulated response computed in a single step usingsim(idnlarx)
:
Nonlinearity Evaluation
This examples performs a low-level computation of the nonlinearity response for thesigmoidnet
network function:
wherefis the sigmoid function, given by the following equation:
InF(x)
, the input to the sigmoid function isx-r
。x
is the regressor value andr
is regressor mean, computed from the estimation data.
,
, and
are the network parameters stored in the model propertyM.nl.par
, whereM
is anidnlarx
object.
电脑及相关知识ute the output value at time t=1, when the regressor values arex=[estData.y(1),estData.u(2)]
:
Estimate model from sample data.
Assign values to the parameters in the expression forF(x)
。
电脑及相关知识ute the linear portion of the response (plus offset).
电脑及相关知识ute the nonlinear portion of the response.
电脑及相关知识ute total responsey = F(x) = yLinear + yNonlinear
。
y
is equal toevaluate(NL,x)
。