Sunteți pe pagina 1din 4

8/22/2020 Prediction error for identified model - MATLAB pe - MathWorks India

pe
Prediction error for identified model

Syntax
err = pe(sys,data,K)
err = pe(sys,data,K,opt)
[err,x0e,sys_pred] = pe( ___ )
pe(sys,data,K, ___ )
pe(sys,Linespec,data,K, ___ )
pe(sys1,...,sysN,data,K, ___ )
pe(sys1,Linespec1,...,sysN,LinespecN,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 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(sys,data,K, ___ ) plots the prediction error. Use with any of the previous input argument combinations. To change display options in
the plot, right-click the plot to access the context menu. For more details about the menu, see Tips.

pe(sys,Linespec,data,K, ___ ) uses Linespec to specify the line type, marker symbol, and color.

pe(sys1,...,sysN,data,K, ___ ) plots the prediction errors for multiple identified models. pe automatically chooses colors and line styles.

pe(sys1,Linespec1,...,sysN,LinespecN,data,K, ___ ) uses the line type, marker symbol, and color specified for each model.

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

Linespec Line style, marker, and color

Line style, marker, and color, specified as a character vector. For example, 'b' or 'b+:'.

For more information about configuring Linespec, see plot.

https://in.mathworks.com/help/ident/ref/pe.html 1/4
8/22/2020 Prediction error for identified model - MATLAB pe - MathWorks India

Output Arguments
err Prediction error.

err is returned as an iddata object or matrix, depending on how you specify data. For example, if data is an iddata
object, then so is err.

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.

Examples collapse all

Compute Prediction Error for an ARIX Model

Compute the prediction error for an ARIX model.


View MATLAB Command
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 one-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));

https://in.mathworks.com/help/ident/ref/pe.html 2/4
8/22/2020 Prediction error for identified model - MATLAB pe - MathWorks India

Compare the computed value with model's noise variance.

sys.NoiseVariance

The output of sys.NoiseVariance matches the computed variance.

Plot Prediction Error for Multiple Models

Load the estimation data.


View MATLAB Command

load iddata1;
data = z1;

Estimate an ARX model of order [2 2 1].

sys1 = arx(data,[2 2 1]);

Estimate a transfer function with 2 poles.

sys2 = tfest(data,2);

Plot the prediction error for the estimated models. Specify prediction horizon as 10, and specify the line styles for plotting the
prediction error of each system.

pe(sys1,'r--',sys2,'b',data,10);

To change the display options, right-click the plot to access the context menu. For example, to view the estimation data, select
Show Validation Data from the context menu. To view the predicted outputs, select Predicted Response Plot.

https://in.mathworks.com/help/ident/ref/pe.html 3/4
8/22/2020 Prediction error for identified model - MATLAB pe - MathWorks India

Tips
• Right-clicking the plot of the prediction error opens the context menu, where you can access the following options:
˗ Systems — Select systems to view prediction error. By default, the prediction error of all systems is plotted.
˗ Data Experiment — For multi-experiment data only. Toggle between data from different experiments.
˗ Characteristics — View the following data characteristics:
˗ Peak Value — View the absolute peak value of the data. Applicable for time–domain data only.
˗ Peak Response — View peak response of the data. Applicable for frequency–response data only.
˗ Mean Value — View mean value of the data. Applicable for time–domain data only.

˗ Show — For frequency–domain and frequency–response data only.


˗ Magnitude — View magnitude of frequency response of the system.
˗ Phase — View phase of frequency response of the system.

˗ Show Validation Data — Plot data used to compute the prediction error.
˗ I/O Grouping — For datasets containing more than one input or output channel. Select grouping of input and output channels
on the plot.
˗ None — Plot input-output channels in their own separate axes.
˗ All — Group all input channels together and all output channels together.

˗ I/O Selector — For datasets containing more than one input or output channel. Select a subset of the input and output channels
to plot. By default, all output channels are plotted.
˗ Grid — Add grids to the plot.
˗ Normalize — Normalize the y-scale of all data in the plot.
˗ Full View — Return to full view. By default, the plot is scaled to full view.
˗ Prediction Horizon — Set the prediction horizon, or choose simulation.
˗ Initial Condition — Specify handling of initial conditions. Not applicable for frequency-response data.
Specify as one of the following:
˗ Estimate — Treat the initial conditions as estimation parameters.
˗ Zero — Set all initial conditions to zero.
˗ Absorb delays and estimate — Absorb nonzero delays into the model coefficients and treat the initial conditions as
estimation parameters. Use this option for discrete-time models only.

˗ Predicted Response Plot — Plot the predicted model response.


˗ Prediction Error Plot — Plot the error between the model response and prediction data. By default, the error plot is shown.
˗ Properties — Open the Property Editor dialog box to customize plot attributes.

See Also
ar | arx | compare | iddata | n4sid | peOptions | predict | resid | sim

Introduced before R2006a

https://in.mathworks.com/help/ident/ref/pe.html 4/4

S-ar putea să vă placă și