Skip to content

Instantly share code, notes, and snippets.

@ritwikraha
Created March 19, 2020 14:03
Show Gist options
  • Save ritwikraha/8c4a63f4d340e8e7419144447bb73cd5 to your computer and use it in GitHub Desktop.
Save ritwikraha/8c4a63f4d340e8e7419144447bb73cd5 to your computer and use it in GitHub Desktop.
For wavelet decomposition of EEG signals
%Applying bandpass filter to filter out the unwanted signal <4 and >30Hz
yy1=bandpass(SSS1,[4 30],128);
%Apply DWT at 5 level of decomposition
waveletFunction = 'db2';
[C,L] = wavedec(yy1,5,waveletFunction);
cD11 = detcoef(C,L,1);
cD21 = detcoef(C,L,2);
cD31 = detcoef(C,L,3);
cD41 = detcoef(C,L,4);
cD51 = detcoef(C,L,5);
cA51 = appcoef(C,L,waveletFunction,5);
D11 = wrcoef('d',C,L,waveletFunction,1); %Gamma
D21 = wrcoef('d',C,L,waveletFunction,2); %Beta
D31 = wrcoef('d',C,L,waveletFunction,3); %Alpha
D41 = wrcoef('d',C,L,waveletFunction,4);
D51 = wrcoef('d',C,L,waveletFunction,5);
A51 = wrcoef('a',C,L,waveletFunction,5);
%Find the mean
av1 = mean(D31);
%Find the standard deviation
sdA1 = std(D31);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment