-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetCorrentropy.m
37 lines (32 loc) · 978 Bytes
/
getCorrentropy.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function [corr] = getCorrentropy(signal, nLevels, wFamily, sigma)
%GETCORRENTROPY calcules the correntropy between
% each Wavelet Leaves and the original signal
%
% DEPENDECIES: ITL toolbox for Correntropy function
%
% [corr] = getCorrentropy(signalWindow, nLevels, wFamily)
%
% PARAMETERS:
% signal - array with a ECG signal.
%
% nLevels - integer with number of Wavelet Levels.
%
% wFamily - Wavelet Family (e.g.: 'db3').
%
% RETURN:
% corr - array with 2^nLevels correntopy indices.
if ~exist('sigma', 'var') sigma = 0.005; end
wtree = wpdec(signal, nLevels, wFamily);
corr = zeros(1, 2^nLevels);
newt = getResetWtree(wtree);
i = 1;
for node = leaves(wtree)'
cfs = read(wtree, 'data', node);
newt = write(newt, 'data', node, cfs);
X = wprec(newt);
corr(i) = corren(signal, X, sigma);
i = i +1;
cfs(:) = 0;
newt = write(newt, 'data', node, cfs);
end
end