Diff of /Feature Extraction/app4.m [000000] .. [db7908]

Switch to unified view

a b/Feature Extraction/app4.m
1
% Extract Common Spatial Pattern (CSP) Feature
2
close all; clear; clc;
3
4
load dataset_BCIcomp1.mat
5
6
EEGSignals.x=x_train;
7
EEGSignals.y=y_train;
8
Y=y_train;
9
10
classLabels = unique(EEGSignals.y); 
11
CSPMatrix = learnCSP(EEGSignals,classLabels);
12
nbFilterPairs = 1;
13
14
X = extractCSP(EEGSignals, CSPMatrix, nbFilterPairs);  
15
EEGSignals.x=x_test;
16
T = extractCSP(EEGSignals, CSPMatrix, nbFilterPairs);  
17
18
save dataCSP.mat X Y T
19
20
21
color_L = [0 102 255] ./ 255;
22
color_R = [255, 0, 102] ./ 255;
23
24
pos = find(Y==1);
25
plot(X(pos,1),X(pos,2),'x','Color',color_L,'LineWidth',2);
26
27
hold on
28
pos = find(Y==2);
29
plot(X(pos,1),X(pos,2),'o','Color',color_R,'LineWidth',2);
30
31
legend('Left Hand','Right Hand')
32
xlabel('C3','fontweight','bold')
33
ylabel('C4','fontweight','bold')
34