Skip to Main Content Skip to Search
Product Documentation

pe - Prediction error for an identified model

Syntax

err = pe(sys,data,K)
err = pe(sys,data,K,___,opt)
[err,x0e,sys_pred] = pe(sys,data,K,___,opt)
pe(sys,data,K,___)

Description

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 of 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(sys,data,K,___,opt) also returns the estimated initial state, x0e, and a predictor system, sys_pred.

pe(sys,data,K,___) 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 may 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 that configures the computation of the predicted response. Options that you can specify include:

  • handling of initial conditions

  • data offsets

Use peOptions to create the options set.

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, it yields an output, yp, such that err.OutputData = data.OutputData - yp. For state-space models, x0e is used 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.

Examples

Compute Prediction Error for an ARIX Model

Compute the prediction error for an ARIX model.

Use the error data to compute the variance of the noise source e(t).

Obtain noisy data.

noise = [(1:150)';(151:-1:2)'];  

load iddata1 z1;
z1.y = z1.y+noise;

noise is a triangular wave that is added to the output signal of z1, an iddata object.

Estimate an ARIX model for the noisy data.

sys = arx(z1,[2 2 1],'IntegrateNoise',true);

Compute the prediction error of the estimated model.

K = 1;
err = pe(z1,sys,K);

pe computes the 1-step prediction error for the output of the identified model, sys.

Compute the variance of the noise source, e(t).

noise_var = err.y'*err.y/(299-nparams(sys)-order(sys));

Compare the computed value with model's noise variance.

sys.NoiseVariance

The output of sys.NoiseVariance matches the computed variance.

See Also

ar | arx | compare | iddata | idpar | lsim | n4sid | peOptions | predict | resid | sim

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS