|
a |
|
b/Feature Extraction/app3.m |
|
|
1 |
% Extract Power Spectrum Density (PSD) Feature |
|
|
2 |
close all; clear; clc; |
|
|
3 |
|
|
|
4 |
load dataset_BCIcomp1.mat |
|
|
5 |
Y=y_train; |
|
|
6 |
|
|
|
7 |
% Range is 0 to 9 sec |
|
|
8 |
startS=0; |
|
|
9 |
endS=9; |
|
|
10 |
wStep=1; |
|
|
11 |
wRange=9; |
|
|
12 |
|
|
|
13 |
X=extractPSD(x_train,startS,endS,wStep,wRange); |
|
|
14 |
T=extractPSD(x_test,startS,endS,wStep,wRange); |
|
|
15 |
save dataPSD.mat X Y T |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
color_L = [0 102 255] ./ 255; |
|
|
19 |
color_R = [255, 0, 102] ./ 255; |
|
|
20 |
|
|
|
21 |
pos = find(Y==1); |
|
|
22 |
plot(X(pos,1),X(pos,2),'x','Color',color_L,'LineWidth',2); |
|
|
23 |
|
|
|
24 |
hold on |
|
|
25 |
pos = find(Y==2); |
|
|
26 |
plot(X(pos,1),X(pos,2),'o','Color',color_R,'LineWidth',2); |
|
|
27 |
|
|
|
28 |
legend('Left Hand','Right Hand') |
|
|
29 |
xlabel('C3','fontweight','bold') |
|
|
30 |
ylabel('C4','fontweight','bold') |
|
|
31 |
|