Estimate impulse response using prewhitened-based correlation analysis
[ir,R,cl] = cra(data,M,na,plot)
cra prewhitens the input sequence; that is, cra 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 correspond 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.
Specify data as an iddata object containing time-domain data only.
data should contain data for a single-input, single-output experiment. For the multivariate case, apply cra to two signals at a time, or use impulse.
Number of lags for which the covariance/correlation functions are computed.
M specifies 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.
Order of the AR model to which the input is fitted.
For the prewhitening, the input is fitted to an AR model of order na.
Use na = 0 to obtain the covariance and correlation functions of the original data sequences.
Plot display control.
Specify plot as one of the following integers:
Estimated impulse response.
The first entry of ir corresponds to lag zero. (Negative lags are excluded in ir.)
99 % significance level for the impulse response.
Compare a second-order ARX model's impulse response with the one obtained by correlation analysis.
load iddata1 z=z1; ir = cra(z); m = arx(z,[2 2 1]); imp = [1;zeros(20,1)]; irth = sim(m,imp); subplot(211) plot([ir irth]) title('impulse responses') subplot(212) plot([cumsum(ir),cumsum(irth)]) title('step responses')
An often better alternative to cra is impulseest, which use a high-order FIR model to estimate the impulse response.