Accelerating the pace of engineering and science

Documentation Center

• Trial Software

findstates(idnlhw)

Estimate initial states of nonlinear Hammerstein-Wiener model from data

Syntax

X0 = findstates(MODEL,DATA)
X0 = findstates(MODEL,DATA,X0INIT)
X0 = findstates(MODEL,DATA,X0INIT,PVPairs)
[X0, REPORT] = findstates(...)

Description

X0 = findstates(MODEL,DATA) estimates the initial states of an idnlhw model from given data. The states of an idnlhw model are defined as the states of its embedded linear model (Model.LinearModel). For more information about the states of idnlhw models, see idnlhw States.

X0 = findstates(MODEL,DATA,X0INIT) specifies an initial guess for value of X0 using X0INIT.

X0 = findstates(MODEL,DATA,X0INIT,PVPairs) specifies property-value pairs representing the algorithm properties that control the numerical optimization process.

[X0, REPORT] = findstates(...) creates a report to summarize results of numerical optimization that is performed to search for the model states.

Input Arguments

• MODEL: idnlhw 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.

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

Output Arguments

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

Examples

In this example, you create an idnlarx model from sample data and estimate initial states using another data set. Next you jointly estimate the states for separate data sets contained in multi-experiment data.

1. Load the data and create iddata objects z1 and z2.

```load twotankdata

z = iddata(y, u, 0.2,'Name','Two tank system');
z1 = z(1:1000); z2 = z(1001:2000);```
2. Estimate an idnlhw model from data.

```m1=nlhw(z1,[4 2 1], 'unitgain' , 'pwlinear')
```
3. Estimate the initial states of m1 using data z2.

```% Estimate initial states. View estimation trace and use
% only 5 iterations in the search algorithm
X0 = findstates(m1,z2,[],'MaxIter',5,'Display','on')```
4. Estimate states using multiple-experiment data. There are separate sets of initial states for each experiment. The states of all data experiments are jointly estimated, and X0 is returned as a matrix with as many columns as there are data experiments.

```zm = merge(z1,z2);
X0 = findstates(m1, zm)
```