Contents

nncorr

Crross correlation between neural network time series

Syntax

nncorr(a,b,maxlag,'flag')

Description

nncorr(a,b,maxlag,'flag') takes these arguments,

a

Matrix or cell array, with columns interpreted as timesteps, and having a total number of matrix rows of N.

b

Matrix or cell array, with columns interpreted as timesteps, and having a total number of matrix rows of M.

maxlag

Maximum number of time lags

flag

Type of normalization (default = 'none')

and returns an N-by-M cell array where each {i,j} element is a 2*maxlag+1 length row vector formed from the correlations of a elements (i.e., matrix row) i and b elements (i.e., matrix column) j.

If a and b are specified with row vectors, the result is returned in matrix form.

The options for the normalization flag are:

  • 'biased' — scales the raw cross-correlation by 1/N.

  • 'unbiased' — scales the raw correlation by 1/(N-abs(k)), where k is the index into the result.

  • 'coeff' — normalizes the sequence so that the correlations at zero lag are 1.0.

  • 'none' — no scaling. This is the default.

Examples

Here the autocorrelation of a random 1-element, 1-sample, 20-timestep signal is calculated with a maximum lag of 10.

a = nndata(1,1,20)
aa = nncorr(a,a,10)

Here the cross-correlation of the first signal with another random 2-element signal are found, with a maximum lag of 8.

b = nndata(2,1,20)
ab = nncorr(a,b,8)
Was this topic helpful?