0001 function nonCorrelated = ensembleNonCorrelatedDetector( detrended_sig, R_locs, minCorrelation, windowSize )
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 nonCorrelated = zeros(1,length(R_locs));
0022
0023 avg = zeros(1,(2*windowSize+1));
0024
0025 left = R_locs-windowSize;
0026 right = R_locs+windowSize;
0027
0028 parfor i=1:length(R_locs)
0029 leftIndex = left(i);
0030 rightIndex = right(i);
0031 if(leftIndex < 0 || rightIndex > length(R_locs))
0032 continue;
0033 end
0034 complex = detrended_sig(leftIndex:rightIndex);
0035 avg = avg + complex;
0036 end
0037
0038 avg = avg./length(R_locs);
0039
0040 parfor i=1:length(R_locs)
0041 leftIndex = left(i);
0042 rightIndex = right(i);
0043 if(leftIndex < 0 || rightIndex > length(detrended_sig))
0044 continue;
0045 end
0046 complex2 = detrended_sig(leftIndex:rightIndex);
0047 corrCoeff = corrcoef(complex2, avg);
0048 if(corrCoeff(1,2) > minCorrelation)
0049 continue
0050 else
0051 nonCorrelated(i) = 1;
0052 end
0053 end
0054
0055
0056
0057
0058 end
0059