control.correlation
- control.correlation(T, X, Y=None, squeeze=True)[source]
Compute the correlation of time signals.
For a time series X(t) (and optionally Y(t)), the correlation() function computes the correlation matrix E(X’(t+tau) X(t)) or the cross-correlation matrix E(X’(t+tau) Y(t)]:
tau, Rtau = correlation(T, X[, Y])
The signal X (and Y, if present) represent a continuous or discrete-time signal sampled at times T. The return value provides the correlation Rtau between X(t+tau) and X(t) at a set of time offsets tau.
- Parameters
- T1D array_like
Sample times for the signal(s).
- X1D or 2D array_like
Values of the signal at each time in T. The signal can either be scalar or vector values.
- Y1D or 2D array_like, optional
If present, the signal with which to compute the correlation. Defaults to X.
- squeezebool, optional
If True, squeeze Rtau to remove extra dimensions (useful if the signals are scalars).
- Returns
- tauarray
Array of time offsets.
- Rtauarray
Correlation for each offset tau.