Estimate initial states of identified linear state-space model from data


x0 = findstates(sys,data)
x0 = findstates(sys,data,K)
x0 = findstates(sys,data,K,opt)


x0 = findstates(sys,data) estimates the initial state values of a state-space model, sys, to maximize the least squares fit between the measured output data, data, and the model response.

x0 = findstates(sys,data,K) specifies the prediction horizon, K, for computing the response of sys.

x0 = findstates(sys,data,K,opt) estimates the initial state using the option set, opt, to specify initial condition constraints, signal offsets, etc.

Input Arguments


Identified linear state-space model.

Specify sys as an idss or idgrey model.


Input-output data.

Specify data as an iddata object with input/output dimensions that match sys.

data can be a frequency-domain iddata object. Ideally, the frequency vector of data should be symmetric about the origin.

If you are converting time-domain data into frequency-domain data, use fft. Use the 'compl' input argument with fft and ensure that there is sufficient zero padding. Note that for an N-point fft, the input/output signals are scaled by 1/sqrt(N). Therefore, the estimated x0 vector is also scaled by this factor. So, scale your data appropriately when you compare x0 between the time-domain and frequency-domain.


Prediction horizon for computing the response of sys.

Specify K as a positive integer between 1 and Inf. The most common values used are:

  • K=1 — Minimizes the 1-step prediction error. That is, the 1–step ahead prediction response of sys is compared to the output signals in data to determine x0.

  • K=Inf — Minimizes the simulation error. That is, the difference between the measured output, data.y, and the simulated response of sys to the measured input data, data.u.

For continuous-time models, specify K as either 1 or Inf.

For continuous-time frequency-domain data, specify K as Inf.

Default: 1 (for all data except continuous-time frequency-domain data)


Option set.

opt is an options set that allows you to constrain the initial state, remove signal offsets, etc.

Use findstatesOptions to create the options set.

Output Arguments


Estimated initial state.

For multi-experiment data, x0 is a matrix with one column for each experiment.


expand all

Estimate Initial States of State-Space Model

Estimate an idss model and simulate it such that the response of the estimated model matches the estimation data's output signal as closely as possible.

Load sample data.

load iddata1 z1;

Estimate a linear model from the data.

model = ssest(z1,2);

Estimate the value of the initial states to best fit the measured output z1.y.

x0est = findstates(model,z1,Inf);

Simulate the model.

opt = simOptions('InitialCondition',x0est);

Was this topic helpful?