correlate.m
SYNTAX: [corrfn,time] = correlate(data1,time1,data2,time2,dt,zl)
PURPOSE: Compute approximation of analog correlation function:
corrfn(t) = integral_{-infinity}^{+infinity} data1(s) data2(s+t) ds
Numerical integration is done so that amplitude is approx. correct
to represent the cross-correlation of the two continuous signals which
these sampled data signals represent. Corresponding time data is
produced rather than just sample indices.
INPUT:
data1, time1 = first signal
data2, time2 = second signal (optional, if no 2nd signal then
autocorrelation of 1st signal is computed)
dt = time between samples (optional, default = min dt of time1, time2)
zl = zero level = multiplier of average absolute value of
computed correlation function, used to eliminate "zero"
values at beginning and end of correlation function
(optional, default = 1e-8). Set=0 to prevent zero eliminations.
OUTPUT:
corrfn, time = correlation function (either cross- or auto-)
Dependencies