Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Predict K-step ahead model output

This `predict`

command computes the
K-step ahead output of an identified model using measured input-output
data. To identify the model, you first collect all the input-output
data and then estimate the model parameters offline. To perform online
state estimation of a nonlinear system using real-time data, use the `predict`

command
for extended and unscented Kalman filters instead.

`yp = predict(sys,data,K)`

`yp = predict(sys,data,K,opt)`

```
[yp,x0,sys_pred]
= predict(___)
```

`predict(sys,data,K,___)`

`predict(sys,Linespec,data,K,___)`

`predict(sys1,...,sysN,data,K,___)`

`predict(sys1,Linespec1,...,sysN,LinespecN,data,K,___)`

predicts
the output of an identified model `yp`

= predict(`sys`

,`data`

,`K`

)`sys`

, `K`

steps
ahead using the measured input-output data.

`predict`

command predicts the output response
over the time span of measured data. In contrast, `forecast`

performs prediction into the
future in a time range beyond the last instant of measured data. Use `predict`

to
validate `sys`

over the time span of measured data.

`predict(`

plots the predicted output. 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.`sys`

,`data`

,`K`

,___)

You can also plot the predicted model response using the `compare`

command. The `compare`

command
compares the prediction results with observed data and displays a
quantitative goodness of fit.

Right-clicking the plot of the predicted output opens the context menu, where you can access the following options:

**Systems**— Select systems to view predicted response. By default, the response 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 predict the model response.**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. By default, the response plot is shown.**Prediction Error Plot**— Plot the error between the model response and prediction data.**Properties**— Open the Property Editor dialog box to customize plot attributes.