| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → System Identification Toolbox |
| Contents | Index |
| Learn more about System Identification Toolbox |
resid(m,data) resid(m,data,Type) resid(m,data,Type,M) e = resid(m,data);
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 idmodel or idnlmodel 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 one of three kinds depending on the argument Type:
Type = 'Corr' (only available for time-domain data): 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 to M/4 are also included to investigate feedback effects. The result is the same as impulse(e,'sd',2.58,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.
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).
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')
Ljung (1999), Section 16.6.
| compare | |
| predict | |
| sim | |
| simsd |
![]() | resample | retrend | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |