Spike Toolbox |
![]() ![]() |
STCrossCorrelation
Calcualte cross-correlation for instantiated spike trains
Syntax
[vCorrSmoothed, vCorrRaw, vtCorrTime] = ...
STCrossCorrelation(stTrain1, stTrain2
<, tWindow, strKernel, tSmoothing>)
Description
STCrossCorrelation calculates the cross-correlation of two spike trains.
Any mapping information is ignored; this function is designed to work with
spike train instances. STFlatten and STExtract can be used to convert
mapped trains to spike train instances. stTrain<1, 2>
are valid spike
train objects, which must be at least instantiated. Spike train definitions
are not supported by STCrossCorrelation.
tWindow
is an optional argument to specity the time range over which to
calculate the cross correlation. The correlation will stretch over
[-tWindow..tWindow]
. tSmoothing
is an optional argument that specifies the
amount of smoothing to perform on the calculated correlation. A gaussian
smoothing will be performed with a window width of tSmoothing
. If
tSmoothing
is zero, smoothing will not be performed. Both time window
parameters are in seconds. strKernel
can optionally be used to specify
the kernel used for smoothing the correlation function. Recognised kernels
are gaussian
, square
and none
. The defaults for these arguments can
be set using STOptions.
vCorrRaw
will be the raw calculated cross correlation. vCorrSmoothed
will
be the (optionally) smoothed correlation trace. vtCorrTime
will be a
vector of the corresponding time bins for each entry in vCorr...
. If no
output arguments are supplied, the (smoothed) correlation will be plotted in
the current figure.
To perform an autocorrelation, just supply the same spike train twice. In
this case, the zero point will be ignored for smoothing and will be replaced
by a NaN
.
![]() |
STDescribe
![]() |