System Identification Toolbox | ![]() ![]() |
Perform prewhitening based correlation analysis and estimate impulse response.
Syntax
Description
data
is the output-input data given as an iddata
object.
The routine only handles single-input-single-output data pairs. (For the multivariate case, apply cra
to two signals at a time, or use impulse
.) cra
prewhitens the input sequence, i.e., filters u
through a filter chosen so that the result is as uncorrelated (white) as possible. The output y
is subjected to the same filter, and then the covariance functions of the filtered y
and u
are computed and graphed. The cross correlation function between (prewhitened) input and output is also computed and graphed. Positive values of the lag variable then corresponds to an influence from u
to later values of y
. In other words, significant correlation for negative lags is an indication of feedback from y
to u
in the data.
A properly scaled version of this correlation function is also an estimate of the system's impulse response ir
. This is also graphed along with 99% confidence levels. The output argument ir
is this impulse response estimate, so that its first entry corresponds to lag zero. (Negative lags are excluded in ir
.) In the plot, the impulse response is scaled, so that it corresponds to an impulse of height 1/T and duration T, where T is the sampling interval of the data.
The output argument R
contains the covariance/correlation information as follows: The first column of R
contains the lag indices. The second column contains the covariance function of the (possibly filtered) output. The third column contains the covariance function of the (possibly prewhitened) input, and the fourth column contains the correlation function. The plots can be redisplayed by cra(R)
.
The output argument cl
is the 99% confidence level for the impulse response estimate.
The optional argument M
defines the number of lags for which the covariance/correlation functions are computed. These are from -M
to M
, so that the length of R
is 2M
+1. The impulse response is computed from 0 to M
. The default value of M
is 20.
For the prewhitening, the input is fitted to an AR model of order na
. The third argument of cra
can change this order from its default value na = 10
. With na = 0
the covariance and correlation functions of the original data sequences are obtained.
plot: plot = 0
gives no plots. plot = 1
(default) gives a plot of the estimated impulse response together with a 99% confidence region. plot = 2
gives a plot of all the covariance functions.
An often better alternative to cra
are the functions impulse
and step
, which use a high order FIR model to estimate the impulse response.
Examples
Compare a second order ARX model's impulse response with the one obtained by correlation analysis.
ir = cra(z); m = arx(z,[2 2 1]); imp = [1;zeros(19,1)]; irth = sim(m,imp); subplot(211) plot([ir irth]) title('impulse responses') subplot(212) plot([cumsum(ir),cumsum(irth)]) title('step responses')
See Also
![]() | covf | c2d | ![]() |