Debian Codegraph @

biosig4c++/mex/accovf_mex.m

raw
1 % accovf_mex.m computes auto- and cross-correlation functions
2 % between two signals, up to lag. NaN's are considered
3 % as missing values and are ignore.
4 %
5 % The purpose is to speed up these computations (see also [1]):
6 %
7 % for k = -maxlag : maxlag,
8 % Rxy(k+1+maxlag) = mean(X(ixtrain-k) .* Y(ixtrain));
9 % Rxx(k+1+maxlag) = mean(X(ixtrain-k) .* X(ixtrain));
10 % end;
11 %
12 %
13 % Usage:
14 % [Sxx,Nxx,Sxy,Nxy,lag] = accovf_mex(X, Y, maxlag)
15 % [Sxx,Nxx,Sxy,Nxy,lag] = accovf_mex(X, Y, maxlag, tix)
16 % Input:
17 % X: 1st input channel
18 % Y: 2nd input channel
19 % lag: maximum lag
20 % tix: time indices used. This is useful for excluding periods
21 % that should be ignored (e.g. because of artifacts)
22 % Output:
23 % Sxx./Nxx : auto-covariance function
24 % Sxy./Nxy : cross-covariance function
25 %
26 % References:
27 %
28 % [1] Xiaomin Zhang, Alois Schlögl, David Vandael, and Peter Jonas
29 % MOD: A novel machine-learning optimal-filtering method for accurate and efficient detection of subthreshold synaptic events in vivo.
30 % Journal of Neuroscience Methods, Volume 357, 1 June 2021, 109125.
31 % here and supplement
32 % https://www.sciencedirect.com/science/article/pii/S0165027021000601
33 % https://doi.org/10.1016/j.jneumeth.2021.109125
34 %
35