Estimate initial states of nonlinear ARX model from data
X0 = findstates(MODEL,DATA)
X0 = findstates(MODEL,DATA,X0INIT)
X0 = findstates(MODEL,DATA,X0INIT,PRED_OR_SIM)
X0 = findstates(MODEL,DATA,X0INIT,PRED_OR_SIM,PVPairs)
[X0, REPORT] = findstates(...)
X0 = findstates(MODEL,DATA) estimates the initial states of an idnlarx model that minimize the error between the output measurements in DATA and the predicted output of the model. The states of an idnlarx model are defined as the delayed samples of input and output variables. For more information about the definition of states for idnlarx models, see Definition of idnlarx States.
X0 = findstates(MODEL,DATA,X0INIT) specifies an initial guess for estimating the initial states.
X0 = findstates(MODEL,DATA,X0INIT,PRED_OR_SIM) allows switching between prediction-error (default) and simulation-error minimization.
X0 = findstates(MODEL,DATA,X0INIT,PRED_OR_SIM,PVPairs) lets you specify the algorithm properties that control the numerical optimization process as property-value pairs.
[X0, REPORT] = findstates(...) creates a report to summarize results of numerical optimization that is performed to search for the model states.
MODEL: idnlarx model.
DATA: iddata object from which to estimate the initial states of MODEL.
X0INIT: Initial guess for value of X0. Must be a vector of length equal to the number of the states of MODEL (sum(getDelayInfo(MODEL))).
PRED_OR_SIM: Specifies minimization criteria using one of the following values:
'prediction': (Default) Estimation of initial states by minimizing the difference between the measured output data and 1-step-ahead predicted response of the model.
'simulation': Estimation of initial states by minimizing the difference between the measured output and the simulated response of the model. This estimation algorithm can be slower than 'prediction'.
PVPairs: Property-value pairs that specify the algorithm properties that control numerical optimization process. By default, algorithm properties are read from the Algorithm property of MODEL. You can override MODEL.Algorithm properties using property-value pairs. For example you might set SearchMethod, MaxSize, Tolerance, and Display.
X0: Estimated initial state vector corresponding to time DATA.TStart. For multi-experiment data, X0 is a matrix with as many columns as there are experiments.
REPORT: Structure containing the following fields:
'EstimationCriterion': String containing the minimization method used.
'SearchMethod': String indicating the value of the SearchMethod property of MODEL.Algorithm.
'WhyStop': String describing why the estimation was stopped.
'Iterations': Number of iterations carried out during estimation.
'FinalCost': The final value of the sum of squared errors that the search method attempts to minimize
'FirstOrderOptimality': Measure of the gradient of the search direction at the final value of the parameter set when the search algorithm terminates. It is equal to the -norm of the gradient vector.
In this example, you use sample data z1 to create a nonlinear ARX model. You use findstates to compute the initial states of the model such that the difference between the predicted output of the model and the output data in z2 is minimized.
Load the sample data and create two data objects z1 and z2.
load twotankdata % Create data objects z1 and z2. z = iddata(y,u,0.2,'Name','Two tank system'); z1 = z(1:1000); z2 = z(1001:2000);
Estimate the idnlarx model.
% Estimate a nonlinear ARX model from data in z1. mw1 = nlarx(z1,[5 1 3],wavenet('NumberOfUnits',8));
Estimate the initial states of the model.
% Find the initial states X0 of mw1 that minimize % the error between the output data of z2 and the % simulated output of mw1. X0 = findstates(mw1,z2,,'sim')
In this example, you estimate the initial states for each data set in a multiple-experiment data object.
Create a multi-experiment data set from z1 and z2:
% Create a multi-experiment data set. zm = merge(z1,z2);
Estimate the initial states for each experiment in the data set, such that the one-step-ahead prediction error is minimized for each data set.
% Estimate initial states for each data set in zm. X0 = findstates(mw1,zm)