Skip to Main Content Skip to Search
Product Documentation

resid - Compute and test model residuals (prediction errors)

Syntax

resid(m,data)
resid(m,data,Type)
resid(m,data,Type,M)
e = resid(m,data);

Description

data contains the output-input data as an iddata object. Both time-domain and frequency-domain data are supported. data can also be an idfrd object.

m is any linear or nonlinear identified model.

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 one of three kinds depending on the argument Type:

The default for time-domain data is Type = 'Corr'. For frequency-domain data, the default is Type = 'fr'.

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, that is, models that describe the dynamics from the input to the residuals (which should be negligible if m is a good description of the system).

Examples

Here are some typical model validation commands.

e = resid(m,data);
plot(e)
compare(data,m);

To compute a model error model, that is, a model from the input to the residuals to see if any essential unmodeled dynamics are left, do the following:

e = resid(m,data);
me = arx(e,[10 10 0]);
bode(me,'sd',3,'fill')

References

Ljung (1999), Section 16.6.

See Also

compare | predict | sim | simsd

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS