User`s guide
Predicting Model Output at the Command Line
Predicting Model Output at the Command Line
Use the following syntax to compute k-step-ahead prediction of the output
signal using model
m:
yhat = predict(m,[y u],k)
The predicted va
lue
ˆ
|yt t k−
()
is computed using information in u(s) up
to time s=t,andt
hen information in y(s) up to time s=t-kT,whereT is the
sampling interv
al.
The way informa
tion in past outputs is used depends on the disturbance
model of
m.Fore
xample, because H =
1 in the output-error model, there is no
information in
past outputs. In this case, predictions and simulations coincide.
The following e
xample demonstrates commands you can use to evaluate how
well a time-se
ries model predicts future v alues. In this case,
y is the origi n al
series of mont
hly sales figures. The firsthalfofthemeasureddataisusedto
estimate the
time-series model, and then the second h alf of the data is used
to predict h a
lf a year ahe ad.
% Split time-series data into
% two halves
y1 = y(1:48),
y2 = y(49:96)
% Estimate a fourth-order aut oregressive model
% using the first half of the data.
m = ar(y1,4)
% Predict time-series output
yhat = predict(m4,y2,6)
% Plot predicted output
plot(y2,yhat)
9-7