Trouble using Common Spatial Patterns
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I'm trying to use CSP on multiple trials of EEG data but I am unsure if it is correct. There are two classes, think left and think right.
I am using the data set and CSP method described in this paper: http://www.ncbi.nlm.nih.gov/pubmed/23204288
For every trial I calculate this value:
C = (xl*xl')/trace(xl*xl');
where xl is the EEG trial data NxP where N is the number of channels and P the data samples.
Then I get the average of all the values of C for think Left and again for think Right. Then I sum those 2 averages together to get the matrix "CC". Then I do this:
CC = CbarL + CbarR;
[V,D] = eig(CC); %V*D*V'==CC
[lamda, ind] = sort(diag(D),'descend');
V = V(:,ind);
P = sqrt(inv(diag(lamda))) * V';
S1 = P*CbarL*P'; % eig(P*CC*P')==ones
S2 = P*CbarR*P';
[B,I] = eig(S1, S2);
[I,ind] = sort(diag(I));
B = B(:,ind);
W = (B'*P);
Finally
W*xl
gets me my filtered trials. Is this all correct so far?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!