| System Identification Toolbox™ | ![]() |
yp = predict(m,data) [yp,x0p,mpred] = predict(m,data,k,'InitialState',init)
data is the output-input data as an iddata object, and m is any idmodel or idnlmodel object. predict is meaningful only for time-domain data.
The argument k indicates that the k step-ahead prediction of y according to the model m is computed. In the calculation of yp(t), the model can use outputs up to time
![]()
and inputs up to the current time t. The default value of k is 1.
The output yp is an iddata object containing the predicted values as OutputData.
x0p is the used (estimated) initial state vector. For multiexperiment data, x0p is a matrix, whose columns contain the initial states for each experiment.
The output argument mpred contains the k step-ahead predictor. This is given as a cell array, whose kth entry is an idpoly model for the predictor of output number k. Note that these predictor models have as input both input and output signals in the data set. The channel names indicate how the predictor model and the data fit together.
init determines how to deal with the initial state:
init ='e(stimate)': The initial state is set to a value that minimizes the norm of the prediction error associated with the model and the data.
init = 'd(elayexpand)': Same as 'estimate', but for a model with nonzero InputDelay, the delays are first converted to explicit model delays (using inpd2nk) so that they are contained in x0p.
init = 'z(ero)' sets the initial state to zero.
init = 'm(odel)' uses the model's internally stored initial state.
init = x0, where x0 is a column vector of appropriate dimension, uses that value as initial state. For multiexperiment data, x0 can be a matrix whose columns give different initial states for each experiment. For a continuous-time model m, x0 is the initial state for this model. Any modifications of the initial state that sampling might require are automatically handled. If m has a non-zero InputDelay, and you need to access the values of the inputs during this delay, you must first apply inpd2nk(m). When m is a continuous-time model, it must first be sampled before inpd2nk can be applied.
If init is not specified, the model property m.InitialState is used, so that 'Estimate', 'Backcast', and 'Auto' set init = 'Estimate', while m.InitialState = 'Zero' sets init = 'zero', and 'Model' and 'Fixed' set init = 'model'.
An important use of predict is to evaluate
a model's properties in the mid-frequency range. Simulation with sim (which conceptually corresponds to k = inf) can lead to levels that drift apart, since the low-frequency behavior
is emphasized. One step-ahead prediction is not a powerful test of
the model's properties, since the high-frequency behavior is stressed.
The trivial predictor
can give good predictions in case
the sampling of the data is fast.
Another important use of predict is to evaluate time-series models. The natural way of studying a time-series model's ability to reproduce observations is to compare its k step-ahead predictions with actual data.
Note that for output-error models, there is no difference between the k step-ahead predictions and the simulated output, since, by definition, output-error models only use past inputs to predict future outputs.
The model is evaluated in state-space form, and the state equations
are simulated k steps ahead with initial value
, where
is the Kalman filter state estimate.
Simulate a time series, estimate a model based on the first half of the data, and evaluate the four step-ahead predictions on the second half.
m0 = idpoly([1 -0.99],[],[1 -1 0.2]); e = iddata([],randn(400,1)); y = sim(m0,e); m = armax(y(1:200),[1 2]); yp = predict(m,y,4); plot(y(201:400),yp(201:400))
Note that the last two commands are also achieved by
compare(y,m,4,201:400);
| compare | |
| pe | |
| sim | |
| simsd |
![]() | poly1d | predict(idnlarx) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |