I wanted to analyze our P300 recordings in Matlab and to this end I also wanted to computer the xDAWN spatial filters. Based on the paper it seemed easy to do in Matlab as it can be simply computed by a generalized eigenvalue decomposition. However, when I did the computation in Matlab, this resulted in different spatial filters as the one obtained from OpenViBE.
The one OpenVibe computed looked like that
and the one I computed looked like that
So I went looking in the code of OpenViBE and it appears you don't solve the least squares problem as stated in the paper to compute the "noise free" evoked potentials? I think you computed the average off all evoked potentials, which also seems a reasonable approach as it should be a estimate that is close to the one computed by the least squares (intuitively). So I recomputed the whole thing but now according to the averaged evoked potentials and this resulted in the following filter
which still looks very similar to my first computed spatial filter in the second picture. Meaning that indeed the least-square approach and the averaging approach result in very similar filters. So I looked further to see what is different in the OpenVibe code and found that you computed the numerator matrix
Code: Select all
(l_oAveragedERPMatrix*itpp::inv(l_oDMatrix.transpose()*l_oDMatrix)*l_oAveragedERPMatrix.transpose())
which looks very similar (although still not the same) as the filter computed by OpenViBE.
So my question is, what am I doing wrong?
EDIT: seems like the OpenViBE filter works definitely better than the one I computed, so I'm doing something wrong, but what....
This is roughly the code I used in Matlab
Code: Select all
A = ((D'*D)\(D'*data'));
[W,dd]=eig((data*data')\(A'*D'*D*A));
Best regards,
Dieter Devlaminck