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 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 offets tau.

  • T (1D array_like) – Sample times for the signal(s).

  • X (1D or 2D array_like) – Values of the signal at each time in T. The signal can either be scalar or vector values.

  • Y (1D or 2D array_like, optional) – If present, the signal with which to compute the correlation. Defaults to X.

  • squeeze (bool, optional) – If True, squeeze Rtau to remove extra dimensions (useful if the signals are scalars).