# How to use the syntax of Multilevel 1-D wavelet decomposition in for loop ??

2 views (last 30 days)
afef on 21 Jul 2017
I have to use the syntax of Multilevel 1-D wavelet decomposition which is
[c,l]=wavedec(x,4,'db4');
[cd1,cd2,cd3,cd4]=detcoef(c,l,[1,2,3,4]);
cA4=appcoef(c,l,'db4',4);
for my multichannel EEG signal which contains 23 derivations so i used a for loop to have simple and short code i tried this :
Fs=256;
result=cell(23,1);
d1=designfilt('lowpassfir','PassbandFrequency',0.45,'StopbandFrequency',0.5,'PassbandRipple',3,'StopbandAttenuation',60,'DesignMethod','equiripple');
for n=1:23
deriv=(val(n,:))/2.559375;
t=(0:length(deriv)-1)/Fs;
result{n} = filtfilt(d1,deriv);
moyenne{n}=mean(result{n},2);
variance{n} = std(result{n},[], 2);
Maximale{n}= max(result{n},[],2);
Minimale{n} = min(result{n},[],2);
[c,l]=wavedec(result{n},4,'db4');
[cd1,cd2,cd3,cd4]=detcoef(c,l,[1,2,3,4]);
cA4=appcoef(c,l,'db4',4);
[Ea,Ed]=wenergy(c,l)
energie{n} = {Ea, Ed};
end
[a,b,z,d,e,f,g,h,i,j,k,ll,m,n,o,p,q,r,s,x,u,v,w]=result{:};
But concerning [c,l] , [cd1,cd2,cd3,cd4] and cA4 i only get the result for one derivation How to correct the code to get the results for all the derivations ?