# How to extract frequency sub-bands of an EEG signal using wavelet packet transform?

98 ビュー (過去 30 日間)
Rohtash Dhiman 2014 年 5 月 2 日
コメント済み: Piyush Kant 2020 年 9 月 29 日
i want to decompose a signal with wavelet in 5 subbands: delta (0–4 Hz), theta (4–8 Hz), alpha (8–15 Hz), beta (15–30 Hz), and gamma (30–60 Hz) the technical specifications of the signal sre as follows: "Signals are band-pass filtered between 0.05 and 200 Hz and then digitized at 1000 Hz with 16 bit (0.1 uV) accuracy." So kindly suggest me how can i extract these sub-bands using Wavelet Packet Decomposition. i have tried a lot but could not do the same. suggest me the relevant commands for this purpose.
##### 2 件のコメント表示非表示 1 件の古いコメント
kalarmago 2020 年 4 月 17 日
Hi, I am in the same issue, please, someone could help me and put some code (I am new in Matlab)?

サインインしてコメントする。

### 回答 (1 件)

Abdulhakim Alezzi 2020 年 9 月 18 日
s=eegdata;
figure;p=plot(s);
title('EEG Signal')
fs = 500;
% Sampling frequency
N=length(s);
waveletFunction = 'db8';
[C,L] = wavedec(s,8,waveletFunction);
cD1 = detcoef(C,L,1);
cD2 = detcoef(C,L,2);
cD3 = detcoef(C,L,3);
cD4 = detcoef(C,L,4);
cD5 = detcoef(C,L,5); %GAMA
cD6 = detcoef(C,L,6); %BETA
cD7 = detcoef(C,L,7); %ALPHA
cD8 = detcoef(C,L,8); %THETA
cA8 = appcoef(C,L,waveletFunction,8); %DELTA
D1 = wrcoef('d',C,L,waveletFunction,1);
D2 = wrcoef('d',C,L,waveletFunction,2);
D3 = wrcoef('d',C,L,waveletFunction,3);
D4 = wrcoef('d',C,L,waveletFunction,4);
D5 = wrcoef('d',C,L,waveletFunction,5); %GAMMA
D6 = wrcoef('d',C,L,waveletFunction,6); %BETA
D7 = wrcoef('d',C,L,waveletFunction,7); %ALPHA
D8 = wrcoef('d',C,L,waveletFunction,8); %THETA
A8 = wrcoef('a',C,L,waveletFunction,8); %DELTA
Gamma = D5;
figure; subplot(5,1,1); plot(1:1:length(Gamma),Gamma);title('GAMMA');
Beta = D6;
subplot(5,1,2); plot(1:1:length(Beta), Beta); title('BETA');
Alpha = D7;
subplot(5,1,3); plot(1:1:length(Alpha),Alpha); title('ALPHA');
Theta = D8;
subplot(5,1,4); plot(1:1:length(Theta),Theta);title('THETA');
D8 = detrend(D8,0);
Delta = A8;
%figure, plot(0:1/fs:1,Delta);
subplot(5,1,5);plot(1:1:length(Delta),Delta);title('DELTA');
D5 = detrend(D5,0);
xdft = fft(D5);
freq = 0:N/length(D5):N/2;
xdft = xdft(1:length(D5)/2+1);
figure;subplot(511);plot(freq,abs(xdft));title('GAMMA-FREQUENCY');
[~,I] = max(abs(xdft));
fprintf('Gamma:Maximum occurs at %3.2f Hz.\n',freq(I));
D6 = detrend(D6,0);
xdft2 = fft(D6);
freq2 = 0:N/length(D6):N/2;
xdft2 = xdft2(1:length(D6)/2+1);
% figure;
subplot(512);plot(freq2,abs(xdft2));title('BETA');
[~,I] = max(abs(xdft2));
fprintf('Beta:Maximum occurs at %3.2f Hz.\n',freq2(I));
D7 = detrend(D7,0);
xdft3 = fft(D7);
freq3 = 0:N/length(D7):N/2;
xdft3 = xdft3(1:length(D7)/2+1);
% figure;
subplot(513);plot(freq3,abs(xdft3));title('ALPHA');
[~,I] = max(abs(xdft3));
fprintf('Alpha:Maximum occurs at %f Hz.\n',freq3(I));
xdft4 = fft(D8);
freq4 = 0:N/length(D8):N/2;
xdft4 = xdft4(1:length(D8)/2+1);
% figure;
subplot(514);plot(freq4,abs(xdft4));title('THETA');
[~,I] = max(abs(xdft4));
fprintf('Theta:Maximum occurs at %f Hz.\n',freq4(I));
A8 = detrend(A8,0);
xdft5 = fft(A8);
freq5 = 0:N/length(A8):N/2;
xdft5 = xdft5(1:length(A8)/2+1);
% figure;
subplot(515);plot(freq3,abs(xdft5));title('DELTA');
[~,I] = max(abs(xdft5));
fprintf('Delta:Maximum occurs at %f Hz.\n',freq5(I));
##### 1 件のコメント表示非表示 なし
Piyush Kant 2020 年 9 月 29 日
can you please explain the level selection for the same as Fs=500 thus making max fequency content 0-250Hz so according to me
d1=125-250 Hz
d2= 62.5-125 Hz
d3= 31.75-62.5Hz
d4 = 15.87 - 31.75Hz
d5 ~= 8-16 Hz
d6~= 4-8 Hz
d7=2-4 Hz
d8 = 1-2 Hz
Please correct me if i am wrong

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by