主要内容

残留

Compute and test residuals

描述

example

残留(数据,sys)计算确定模型的1步预测错误(残差),sys, and plots residual-input dynamics as one of the following, depending on the data in数据:

  • For time-domain data,残留绘制残差的自相关以及残差与输入信号的互相关。与滞后-25至25的相关性生成。要指定不同的最大滞后值,请使用残留Options。The 99% confidence region marking statistically insignificant correlations displays as a shaded region around the X-axis.

  • For frequency-domain data,残留plots a bode plot of the frequency response from the input signals to the residuals. The 99% confidence region marking statistically insignificant response is shown as a region around the X-axis.

要更改显示选项,请右键单击绘图以访问上下文菜单。有关菜单的更多详细信息,请参阅提示

example

残留(数据,sys,LinesPec)sets the line style, marker symbol, and color.

example

残留(数据,sys1,...,sysn)computes and plots the residual of multiple identified modelsSYS1,...,,sysn

example

残留(数据,sys1,Linespec1,...,sysn,Linespecn)sets the line style, marker symbol, and color for each system.

example

残留(___,Options)specifies additional residual calculation options. UseOptions使用任何先前的语法。

example

残留(___,类型)specifies the plot type. Use类型使用任何先前的语法。

example

[E,R] =残留(数据,sys)returns the calculated residuals,E, and residual correlations,R。No plot is generated.

例子

collapse all

Load time-domain data.

loadIDDATA1data = z1;

估计ARX模型。

sys = arx(data,[1 1 0]);

绘制残差和输入之间的残差和互相关的自相关。

残留(data,sys)

Figure contains 2 axes objects. Axes object 1 with title AutoCorr contains 2 objects of type line. This object represents sys. Axes object 2 with title XCorr (u1) contains 2 objects of type line. This object represents sys.

The correlations are calculated until the default maximum lag, 25. The 99% confidence region marking statistically insignificant correlations displays as a shaded region around the X-axis.

Convert data to frequency domain.

data2 = fft(data);

计算已识别模型的残差,sys,以及频域数据。使用红色十字绘制残差响应。

残留(data2,sys,'rx')

Figure contains 2 axes objects. Axes object 1 with title From: u1 To: e@y1 contains an object of type line. This object represents sys. Axes object 2 contains an object of type line. This object represents sys.

For frequency-domain data,残留plots the Bode plot showing frequency response from the input to the residuals.

Load time-domain data.

loadIDDATA1

估计ARX模型。

SYS1= arx(z1,[1 1 0]);

Estimate a transfer function model.

SYS2= tfest(z1,2);

Plot the correlations of the residuals.

残留(z1,sys1,'b',sys2,'r')

Figure contains 2 axes objects. Axes object 1 with title AutoCorr contains 4 objects of type line. These objects represent sys1, sys2. Axes object 2 with title XCorr (u1) contains 4 objects of type line. These objects represent sys1, sys2.

残差之间的互相关SYS2所有滞后的置信带中的输入。

Load time-domain data.

loadIDDATA1

估计ARX模型。

sys = arx(z1,[1 1 0]);

Specify the maximum lag for residual correlation calculations.

opt = residOptions('MaxLag',35);

绘制从输入到残差的脉冲响应。

残留(z1,sys,opt,'ir')

Figure contains an axes object. The axes object with title From: u1 To: e@y1 contains 2 objects of type line. This object represents sys.

Load time-domain data.

loadiddata7

The data is a two-input, single-output dataset.

估计ARX模型。

sys = tfest(z7,2);

计算残差及其自相关以及与输入的互相关。

[E,R] = resid(z7,sys);

Ris a 26-by-3-by-3 matrix of correlations. For example,

  • R(:,1,1)is the autocorrelation of the residuals until lag 25.

  • R(:,1,2)is the cross-correlation of the residuals with the first input,until lag 25.

E是具有残差作为输出数据的IDDATA对象,验证数据(Z7)的输入作为输入数据。您可以使用Eto identify error models and analyze the error dynamics.

Plot the error.

plot(E)

Figure contains 3 axes objects. Axes object 1 with title e@y1 contains an object of type line. This object represents E. Axes object 2 with title u1 contains an object of type line. This object represents E. Axes object 3 with title u2 contains an object of type line. This object represents E.

估计输入和残差之间的冲动反应。用3个标准偏离置信区域绘制它们。

i = Impulseest(e);showconconceidence(Impulseplot(i,20),3)

Figure contains 2 axes objects. Axes object 1 with title From: u1 contains 2 objects of type line. This object represents I. Axes object 2 with title From: u2 contains 2 objects of type line. This object represents I.

Input Arguments

collapse all

Validation input-output data, specified as aniddata目的。数据can have multiple input-output channels. Whensys是线性的,数据is time-domain or frequency-domain. Whensysis nonlinear,数据is time-domain.

System used for computing residuals, specified as an identified linear or nonlinear model.

例子:iDpoly

线样式,标记符号和颜色,指定为字符向量。有关更多信息,请参阅plot。When类型is specified as'corr', only the line style is used.

例子:'Linespec','kx'

剩余分析选项, specified as an残留Options选项集。

Plot type, specified as one of the following values:

  • 'corr'— Plots the autocorrelation of the residuals,e, and the cross-correlation of the residuals with the input signals,u。The correlations are generated for lags -25 to 25. Use残留Optionsto specify a different maximum lag value. The 99% confidence region marking statistically insignificant correlations is also shown as a shaded region around the X-axis. The computation of the confidence region is done assumingeto be white and independent ofu

    'corr'is default for time-domain data. This plot type is not available for frequency-domain data.

  • 'ir'— Plots the impulse response up to lag 25 of a system from the input to the residuals. Theimpulseestcommand first estimates the impulse response model witheas output data anduas inputs. Thenimpulseest计算估计模型的脉冲响应。标记统计上微不足道的响应显示为阴影区域的99%置信区域。低幅度表示可靠的模型。

    This plot type is not available for frequency-domain data.

  • 'fr'— The frequency response from the input to the residuals (based on a high-order FIR model) is shown as a Bode plot. The 99% confidence region marking statistically insignificant response displays as a shaded region. A low magnitude in the frequency range of interest indicates a reliable model.

    'fr'is default for frequency-domain data.

Output Arguments

collapse all

Model residuals, returned as aniddata目的。残差存储在e.outputdata, and the inputs are stored ine.inputdata。UseE建立模型,describe the dynamics from the inputs to the residuals. The dynamics are negligible ifsysis a reliable identified model.

Correlations of the residuals, returned as one of the following:

  • Matrix of doubles — For time-domain-data

    Ris a matrix of sizeM+1-by-(ny+nu)-经过-(ny+nu)。在哪里,Mis the maximum lag specified inOptions,nyis the number of outputs, andnu是输入的数量。的默认值M是25。

    At each lagk(k = 0:m),R(k,i,j)is the expectation value,。这里,z = [e.outputdata,e.inputdata]

    For example, for a two-output, single-input model,Z = [e1,e2,u1]。在哪里,e1is the residual of the first output,e2is the residual of the second output, andu1is the input.Ris a26-经过-3-经过-3matrix, where:

    • R(5,1,2) = is the cross-correlation at lag 4 betweene1ande2

    • R(5,1,3) = is the cross-correlation at lag 4 betweene1andu1

    • R(5,1,1),R(5,2,2),R(5,3,3)are the autocorrelations at lag 4 fore1,e2, andu1, respectively.

  • []- 对于频域数据

提示

  • 右键单击图将打开上下文菜单,您可以在其中访问以下选项:

    • 系统——选择系统查看剩余的相关性or response plots. By default, all systems are plotted.

    • 显示信心区域— View the 99% confidence region marking statistically insignificant correlations. Applicable only for the correlation plots.

    • 数据Experiment— For multi-experiment data only. Toggle between data from different experiments.

    • 特征— View data characteristics. Not applicable for correlation plots.

      • Peak Response— View peak response of the data.

      • Confidence Region— View the 99% confidence region marking statistically insignificant response.

    • 节目- 仅适用于频率图。

      • Magnitude— View magnitude of frequency response.

      • Phase- 频率响应的视图阶段。

    • I/O分组— For datasets containing more than one input or output channel. Select grouping of input and output channels on the plot. Not applicable for correlation plots.

      • 没有任何— Plot input-output channels in their own separate axes.

      • All- 将所有输入通道和所有输出通道组合在一起。

    • i/o选择器— For datasets containing more than one input or output channel. Select a subset of the input and output channels to plot. By default, all output channels are plotted.

    • 网格— Add grids to the plot.

    • 归一化- 将图中所有数据的y级标准化。不适用于频率响应数据。

    • Full View- 返回全视图。默认情况下,图将缩放到完整视图。

    • Initial Condition- 指定对初始条件的处理。

      Specify as one of the following:

      • Estimate— Treat the initial conditions as estimation parameters.

      • Zero— Set all initial conditions to zero.

      • Absorb delays and estimate- 吸收非零延迟到模型系数中,并将初始条件视为估计参数。仅将此选项用于离散时间模型。

    • Properties— Open the Property Editor dialog box to customize plot attributes.

参考

[1] Ljung,L。System Identification: Theory for the User。Upper Saddle River, NJ: Prentice-Hall PTR, 1999, Section 16.6.

版本历史

Introduced before R2006a