err = pe(sys,data,K) returns
the K-step prediction error for the output of
the identified model, sys. The prediction error
is determined by subtracting the K-step ahead
predicted response from the measured output. The prediction error
is calculated for the time span covered by data.
For more information on the computation of predicted response, see predict.

err = pe(sys,data,K,opt) returns
the prediction error using the option set, opt,
to specify prediction error calculation behavior.

[err,x0e,sys_pred]
= pe(___) also returns the estimated initial
state, x0e, and a predictor system, sys_pred.

pe(___) plots the prediction
error.

Input Arguments

sys

Identified model.

data

Measured input-output history.

If sys is a time-series model, which has
no input signals, then specify data as an iddata object
with no inputs. In this case, you can also specify data as
a matrix of the past time-series values.

K

Prediction horizon.

Specify K as a positive integer that is
a multiple of the data sample time. Use K = Inf to
compute the pure simulation error.

Default: 1

opt

Prediction options.

opt is an option set, created using peOptions, that configures the computation
of the predicted response. Options that you can specify include:

Handling of initial conditions

Data offsets

Output Arguments

err

Prediction error.

err is an iddata object.

Outputs up to the time t-K and inputs up
to the time instant t are used to calculate the
prediction error at the time instant t.

When K = Inf, the predicted output is a pure
simulation of the system.

For multi-experiment data, err contains
the prediction error data for each experiment. The time span of the
prediction error matches that of the observed data.

x0e

Estimated initial states.

x0e is returned only for state-space systems.

sys_pred

Predictor system.

sys_pred is a dynamic system. When you
simulate sys_pred, using [data.OutputData
data.InputData] as the input, the output, yp,
is such that err.OutputData = data.OutputData - yp.
For state-space models, the software uses x0e as
the initial condition when simulating sys_pred.

For discrete-time data, sys_pred is always
a discrete-time model.

For multi-experiment data, sys_pred is
an array of models, with one entry for each experiment.