System Identification Toolbox | ![]() ![]() |
Compute and test the residuals (prediction errors) of a model.
Syntax
Description
data
contains the output-input data as an iddata
object
m
is the model to be evaluated on the given data set. It is any idmodel
object.
In all cases the residuals e associated with the data and the model are computed. This is done as in the command pe
with a default choice of init
.
When called without output arguments, resid
produces a plot. The plot can be of three kinds depending on the argument Type
:
Type = 'Corr
' (default): The autocorrelation function of e
and the cross correlation between e
and the input(s) u
are computed and displayed. The 99% confidence intervals for these values are also computed and shown as a yellow region. The computation of the confidence region is done assuming e
to be white and independent of u
. The functions are displayed up to lag M
, which is 25 by default.
Type = 'ir
':
The impulse response (up to lag M
, which is 25 by default) from the input to the residuals is plotted with a 99% confidence region around zero marked as a yellow area. Negative lags up tp M
/4 are also included to investigate feedback effects. (The result is the same as impulse(e,
'sd
',2.58,
'fill
',M)
.)
Type = 'fr
':
The frequency response from the input to the residuals (based on a high order FIR model) is shown as a Bode plot. A 99% confidence region around zero is also marked as a yellow area.
With an output argument, no plot is produced, and e
is returned with the residuals (prediction errors) associated with the model and the data. It is an iddata
object with the residuals as outputs and the input in data
as inputs. That means that e
can be directly used to build model error models, i.e., models that describe the dynamics from the input to the residuals (which should be negligible if m
is a good description of the system).
See Model Structure Selection and Validation in the "Tutorial" chapter for more information.
Examples
Here are some typical model validation commands.
To compute a "model error model," that is, a model to input to the residuals to see if any essential unmodeled dynamics are left,
See Also
compare
, idgrey
, idarx
, idpoly
, idss
, pem
References
![]() | resample | roe | ![]() |