Using Autoencoder to get the features from DWT decomposed coefficients

1 view (last 30 days)
I have performed DWT decomposition using Daubechies wavelet on filtered ECG signal. Can anyone help me how to write the code for getting the features from these coefficients using autoencoder?
Here is my code. Thanks in advance.
clc
clearvars
close all
clc;
clearvars
lt=64;
btt=50;
rn1=0.009;
rn2=0.09;
data= importdata('filtered.csv');
x = data(:, 1);
y = data(:, 1);
tg=[];
Ya=y;
clear x y
V=[];
F3=[];
dt=[];
t1=[];
T4=[];
X3=[];
F1=[];
%%wavelet decomposition
clear i j k i1 i2
Ya1=Ya;
clear Ya
Ya=Ya1((45:236+(256*btt)),:);
n= length (Ya);
n1= n/lt;
for i= 1:1:n1
for j=1:1:lt
k=lt*(i-1)+j;
x2(j)=Ya(k);
end
[c,l]=wavedec(x2,5,'db4');
[cd1,cd2,cd3,cd4,cd5] = detcoef(c,l,[1 2 3 4 5]);
A=appcoef(c,l,'db4');
ec1=((sum(cd1.^2))/(length(cd1)));
ec2=((sum(cd2.^2))/(length(cd2)));
ec3=((sum(cd3.^2))/(length(cd3)));
ec4=((sum(cd4.^2))/(length(cd4)));
ec5=((sum(cd5.^2))/(length(cd5)));
ec6=((sum(A.^2))/(length(A)));
dc=[ec1 ec2 ec3 ec4 ec5 ec6];
dc1=sum(dc);
dc=100.*((dc)/dc1);
df=dc(:,(1:3));
xm=mean(x2);
x21=x2-xm;
xe1=(((sum(x21.^2))/lt).^0.5);
xe2=100.*((((sum((cd1-mean(cd1)).^2))/lt).^0.5)/xe1);
xe3=100.*((((sum((cd2-mean(cd2)).^2))/lt).^0.5)/xe1);
xe4=100.*((((sum((cd3-mean(cd3)).^2))/lt).^0.5)/xe1);
rt=xe2+xe3+xe4;
if xe1<=rn1
upt=4;
elseif xe1>rn1 && xe1<rn2
upt=4;
elseif xe1>=rn2
upt=2;
end
tg=[tg;xe1];
for i1=1:1:upt
g(i1)=l((length(l)-1)-upt+i1);
end
if upt>0
g1=sum(g);
else
g1=0;
end
if g1>0
for i2=length(c)-g1+1:length(c)
c(i2)=0;
end
end
if xe1<=0.05
ty=[6 7];
elseif xe1>0.05 && xe1<.2
ty=[5 6];
elseif xe1>=0.2
ty=[4 5];
end
upt;
[x,T3]=coding(upt,x2, c,l,0,ty,i);
T4=[T4;T3];
x=[i 0 0 0 0; x];
[F2]=recon(upt,c,l,x);
if i==0
x
end
[F]=waverec(c,l,'db4');
[prd1]=calprd(x2,F);
df=[df xe1 prd1 rt];
dt=[dt;df];
F1=[F1 F];
X3=[X3 x2];
F3=[F3 F2];
t1=[t1 mean((diff(X3)).^2)];
clear dc dc1 dc g g1 c F x2 c l A F2
end

Answers (1)

ariTU
ariTU on 18 Dec 2019
Did you come up with a solution?
I would be interested in your solution. Thanks :)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!